In ggplot2 2.0.0 you can use the margin = element_text() argument to change the distance between the axis header and the numbers. Set margin values ββon the t op, r ight, b ottom and l eft side of the element.
ggplot(mpg, aes(cty, hwy)) + geom_point()+ theme(axis.title.y = element_text(margin = margin(t = 0, r = 20, b = 0, l = 0)))
margin can also be used for other element_text elements (see ?theme ), such as axis.text.x , axis.text.y and title .
Didzis Elferts Jan 23 '13 at 18:57 2013-01-23 18:57
source share