I’ve been trying to find a simpler bit of R code that will allow axis labels to be written in at an angle, and thanks to my obsessive scanning of the R-help mailing list I found a nice example (all credit to Uwe Ligges and Marc Schwartz for their approach). I’ve made a few cosmetic tweaks in moving the labels off of the x-axis and changing the labels.
The following code will produce the figure below:
labels <- c(“January”, “February”, “March”, “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November”, “December”)
labels <- month.name[1:12]
mp <- barplot(1:12, axes = FALSE, axisnames = FALSE)
text(mp, par(“usr”), labels = labels, srt = 45, adj = c(1.1,1.1), xpd = TRUE, cex=.9)
Configure to your heart’s content. I know I will.
Updated code: R has a few built in constants and I think it makes things much simpler to take advantage of them (letters, LETTERS, month.name, month.abb and pi).