I have the following graph that I generated using ggplot2
I had finalPlo
For the rotation angle of the axis text you need to use element_text()
. See this post on SO for some examples. For spacing over two lines I would add a "\n"
on the location in the string where you want to put the newline.
This will set the correct orientation for the y axis text and force a line break:
finalPlot + ylab("Number of\nSolutions") +
theme(axis.title.y = element_text(angle = 0))
The syntax has changed in recent versions of ggplot2; if you try the above answer, you'll get
Error: Use 'theme' instead. (Defunct; last used in version 0.9.1)
These days you should use
finalPlot + ylab("Number of\nSolutions") + theme(axis.title.y = element_text(angle=0))