19.10 More about the theme() function
The theme() allows a precise control of graphical parameters such as axis text, ticks and labels, or legend texts and labels, etc.
More details here
# Let's the project_long object from exercise 12, and plot boxplots
boxp <- ggplot(data=project_long, aes(x=variable, y=value, color=expr_limits)) +
geom_boxplot()
# Remove the legend title:
boxp + theme(legend.title=element_blank())
# Change font of legend text
boxp + theme(legend.title=element_blank(),
legend.text = element_text(colour="red", size = 8, face = "bold"))
# Put legend on the top of the plot
boxp + theme(legend.title=element_blank(),
legend.text = element_text(colour="red", size = 8, face = "bold"),
legend.position="top")