用ggplot隐藏一个传奇

Fel*_*len 1 r ggplot2

假设我有例如

ggplot(data=PlantGrowth, aes(x=group, y=weight, fill=group)) + geom_boxplot()
Run Code Online (Sandbox Code Playgroud)

而且我不想显示图例.从图中隐藏或删除图例的最简单方法是什么?

Fel*_*len 7

theme(legend.position="none")像这样添加:

ggplot(data=PlantGrowth, aes(x=group, y=weight, fill=group)) + 
  geom_boxplot() + 
  theme(legend.position="none")
Run Code Online (Sandbox Code Playgroud)

(来源)