Graphics Reference
In-Depth Information
Solution
Add guides(fill=guide_legend(title=NULL)) to remove the title from a legend, as in Fig-
ure 10-12 (for other aesthetics, replace fill with the name of the aesthetic, such as colour or
size ):
ggplot(PlantGrowth, aes(x = group, y = weight, fill = group)) + geom_boxplot() +
guides(fill = guide_legend(title = NULL
NULL ))
Figure 10-12. Box plot with no legend title
Discussion
It is also possible to control the legend title when specifying the scale. This has the same effect
as the preceding code:
scale_fill_hue(guide = guide_legend(title = NULL
NULL ))
Search WWH ::




Custom Search