我一直在WEB上搜索删除下面ggplot条形图的图例中的横杆.但是,没有成功.你能帮我解决这个问题.请参阅下面的数据"temp"和我正在使用的代码.你能告诉我如何在酒吧使用模式吗?谢谢.
temp:
type var value
A k1 20
A l1 30
B k1 10
B l1 15
ggplot(temp,aes(type, value)) + geom_bar(stat="identity", aes(group=var, fill=type, facets=var),colour="blue1", position="identity") + facet_grid(.~var) + theme_bw()
Run Code Online (Sandbox Code Playgroud)

我知道这样做的唯一方法是做geom_bar两层,一层用蓝色,但没有图例,一层没有蓝色,但有一个图例:
ggplot(temp,aes(type, value)) +
geom_bar(stat="identity", aes(group=var, fill=type, facets=var),color = "blue1", position="identity",legend = "none") +
geom_bar(stat="identity", aes(group=var, fill=type, facets=var), position="identity") +
facet_grid(.~var) +
theme_bw()
Run Code Online (Sandbox Code Playgroud)

推测一点,我怀疑这不容易的原因是作为一个设计决策,包作者希望传说能够完全匹配图层中的内容.大多数时候,你可能对这种行为感到非常高兴,但偶然的尴尬带来了极大的便利.
| 归档时间: |
|
| 查看次数: |
1806 次 |
| 最近记录: |