10.7 Removing a Legend Title
10.7.2 Solution
Add guides(fill = guide_legend(title = NULL))
to remove the title from a legend, as in Figure 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))

Figure 10.12: Box plot with no legend title