Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Use theme(legend.text=element_text()) (Figure 10-16):
# The base plotp<-ggplot(PlantGrowth,aes(x=group,y=weight,fill=group))+geom_boxplot()# Change the legend label appearancep+theme(legend.text=element_text(face="italic",family="Times",colour="red",size=14))
It’s also possible to specify the legend label
appearance via guides(), although
this method is a bit unwieldy. This has the same effect as the previous
code:
# Changes the legend title text for the fill legendp+guides(fill=guide_legend(label.theme=element_text(face="italic",family="Times",colour="red",size=14)))