Edit: The problem was that I incorrectly tried to change theme(title = element_text()) when I needed to change theme(plot.title(element_text()) . I would have noticed that if I had studied the theme() documentation more carefully theme() .
Original post:
Changing the vertical alignment of the header also changes the position of the x and y axis labels. This is mistake? Or am I misinterpreting the theme () function? I am running ggplot2 version 0.9.3.1
Minimal reproducible example.
require(ggplot2) set.seed(12345) x <- rnorm(100,10,0.5) y <- x * 3 + rnorm(100) df <- data.frame(y,y)
The default title is too close to the schedule for my taste ....
ggplot(df,aes(x,y)) + geom_point() + labs(title="My Nice Graph")

When I try to move the title, the axis labels also move and fuzzy plot the graph.
ggplot(df,aes(x,y)) + geom_point() + labs(title="My Nice Graph") + theme(title = element_text(vjust=2))

r ggplot2
Andrew Barr
source share