Add theme(legend.position="none")
, like this:
ggplot(data=PlantGrowth, aes(x=group, y=weight, fill=group)) +
geom_boxplot() +
theme(legend.position="none")
(source)
Domanda
Suppose for example I have
ggplot(data=PlantGrowth, aes(x=group, y=weight, fill=group)) + geom_boxplot()
and I don't want to display the legend. What is the simplest way to hide or remove the legend from a plot?
Soluzione
Add theme(legend.position="none")
, like this:
ggplot(data=PlantGrowth, aes(x=group, y=weight, fill=group)) +
geom_boxplot() +
theme(legend.position="none")
(source)