I'm trying to lower the axis tick-labels using ggplot, but am running into unexpected difficulties.
"hjust" works fine, but ggplot's "vjust" parameter seems to depend on the value of "angle".
The example below (modifying code from https://github.com/hadley/ggplot2/wiki/Axis-Attributes) shows how the value of "angle" seems to affect "vjust":
plot1 <- function(){
#create simple dataframe for plotting
xy <- data.frame(x=1:10, y=10:1)
#create base plot
p <- ggplot(data = xy)+ geom_point(aes(x = x, y = y))
#plot base plot
p <- p + theme(axis.text.x = element_text(colour="red", angle = 45, size = 10, vjust = 7))
print(p)
}
produces a plot with the axis tick-labels (2.5, 5.0, 7.5, 10.0) along the line y=2.5.
However, removing the "angle" argument in the second last line, i.e.
p <- p + theme(axis.text.x = element_text(colour="red", size = 10, vjust = 7))
produces a plot with the axis tick-labels underneath the x-axis (as they would usually be - but "vjust" hasn't been changed).
According to the documentation, vjust (and hjust) are technically supposed to only be in the interval [0,1], but no matter what value I choose for "vjust", (positive/negative/large/small), I cannot get the axis tick-labels to move up or down without defining "angle" to be some non-zero value.
I apologize, but I am not able to post any pictures because this is my first question and I don't have enough reputation points.
This is the first time I've asked a question, because previously any ggplot question I had had already been asked (and answered) on this site. I've looked all over, but haven't managed to find anyone else experiencing the same problem.
Any help would be greatly appreciated.
I am running R 2.15.1 and ggplot2 0.9.3, and sessionInfo() yields:
other attached packages:
[1] ggplot2_0.9.3 rj_1.1.0-4
loaded via a namespace (and not attached):
[1] colorspace_1.2-0 dichromat_1.2-4 digest_0.6.0 grid_2.15.2
[5] gtable_0.1.2 labeling_0.1 MASS_7.3-22 munsell_0.4
[9] plyr_1.8 proto_0.3-9.2 RColorBrewer_1.0-5 reshape2_1.2.2
[13] rj.gd_1.1.0-1 scales_0.2.3 stringr_0.6.2 tools_2.15.2