<分区>
假设我有
ggplot(data=PlantGrowth, aes(x=group, y=weight, fill=group)) + geom_boxplot()
而且我不想显示图例。从图中隐藏或删除图例的最简单方法是什么?
<分区>
假设我有
ggplot(data=PlantGrowth, aes(x=group, y=weight, fill=group)) + geom_boxplot()
而且我不想显示图例。从图中隐藏或删除图例的最简单方法是什么?
最佳答案
添加主题(legend.position="none")
,像这样:
ggplot(data=PlantGrowth, aes(x=group, y=weight, fill=group)) +
geom_boxplot() +
theme(legend.position="none")
( source )
关于r - 使用 ggplot 隐藏图例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23682371/