David B David B - 9 months ago 44
R Question

How can I add a subtitle and change the font size of ggplot plots in R?

I tried adding a subtitle using

but nothing showed up. The main title does work (

I would also like to use a larger font for the axis (labels and coordinates), but I can't tell how to do that.

Answer Source

theme_get() will show you the "hidden" options that you can use in opts(), post 0.91 it's theme()



Pre 0.91:


Change size, to your desired size.

wrt the title, you can use "\n" to move the remaining text to a new line:


labs(title="text \n more text")

Pre 0.91:

opts(title="text \n more text") 

ggplot2 doesn't have "subtitle" functionality. But you can use the \n term in any of the labels to drop down a line.