I have a plot where the x-axis is a factor whose labels are long. While probably not an ideal visualization, for now I'd like to simply rotate these labels to be vertical. I've figured this part out with the code below, but as you can see, the labels aren't totally visible.

To those for whom hjust is not behaving as described here, try theme(axis.text.x=element_text(angle = 90, vjust = 0.5)). As of ggplot2 0.9.3.1 this seems to be the solution.
– lilsterAug 12 '13 at 6:51

I'd like to provide an alternate solution, a robust solution similar to what I am about to propose was required in the latest version of ggtern, since introducing the canvas rotation feature.

Basically, you need to determine the relative positions using trigonometry, by building a function which returns an element_text object, given angle (ie degrees) and positioning (ie one of x,y,top or right) information.

I do not obtain the same results, for me the axis text is never well adjusted using your auto method. However, using rads = (-angle - positions[[ position ]])*pi/180 produced better placements. Note the additional minus sign before angle. Thanks for the code anyway :)
– antoine-sacAug 26 '16 at 11:52