1. Your example is not reproducible. Google "R reproducible example"
and check out several of the top half dozen or so hits to learn how to
write an effective help request on R-related groups.
2. See
https://github.com/hadley/ggplot2/issues/1435, as this issue
has come up before. Hadley developed the margin() function and the
margin = argument in element_text() to deal with the problems created
by vjust and hjust. Check out the help page of ggplot2::margin for
details; in this case, you want to use l (left) and r (right). Here is
a toy example to illustrate, adding a title to show how the t (top)
and b (bottom) arguments work, which also apply to x-axis titles.
DF <- data.frame(x = seq(10), y = seq(10))
p <- ggplot(DF, aes(x = x, y = y)) + geom_point(size = 3) +
ggtitle("A plot title")
p
# Default unit for margin() is points
p + theme(axis.title.y = element_text(margin = margin(l = 0, r = 10))
p + theme(axis.title.y = element_text(margin = margin(l = 10, r = 10))
p + theme(plot.title = element_text(margin = margin(b = 20)))
p + theme(plot.title = element_text(margin = margin(t = 20, b = 20)))
3. Another dynamite plot...sigh. Plot errorbars with a point geom at
the mean instead. It conveys the same message, only more cleanly and
with far less ink. If you need to see y = 0 in the plot, then set the
limits in scale_y_continuous() accordingly.
Dennis