i change vertical adjustment of individual tick mark labels in plot. i've looked @ documentation on element_text
, @ questions (this 1 helpful) discuss hjust/vjust applied axis text. when try apply vector of vjust values axis text, axis text font face changes , distance between axis text , axis , axis label change too. if can point me documentation explains behavior, appreciated.
here minimal example:
p <- ggplot(data = mtcars, aes(x=wt, y=mpg)) + geom_point() p + theme(axis.text.x = element_text(vjust = c(0,-.5,0,0)))
you may need settle workaround:
library(ggplot2) p <- ggplot(data = mtcars, aes(x=wt, y=mpg)) p <- p + geom_point() p <- p + scale_x_continuous(breaks=c(2:5), labels=c("2", "\n3", "4\n", "\n\n5")) p