Se si desidera ruotare le etichette x assi con angolo uguale o minore di 90, provare il seguente approccio:
Esso utilizza l'argomento del barplot space=1
fare la larghezza delle colonne è uguale allo spazio intervallo delle colonne.
In questo modo, è stato possibile adattare il codice fornito nello R FAQ che è stato individuato da @BenBarnes sotto la risposta di Tyler Rinker.
par(mar = c(7, 4, 2, 2) + 0.2) #add room for the rotated labels
#use mtcars dataset to produce a barplot with qsec colum information
mtcars = mtcars[with(mtcars, order(-qsec)), ] #order mtcars data set by column "qsec" (source: http://stackoverflow.com/questions/1296646/how-to-sort-a-dataframe-by-columns-in-r)
end_point = 0.5 + nrow(mtcars) + nrow(mtcars)-1 #this is the line which does the trick (together with barplot "space = 1" parameter)
barplot(mtcars$qsec, col="grey50",
main="",
ylab="mtcars - qsec", ylim=c(0,5+max(mtcars$qsec)),
xlab = "",
space=1)
#rotate 60 degrees, srt=60
text(seq(1.5,end_point,by=2), par("usr")[3]-0.25,
srt = 60, adj= 1, xpd = TRUE,
labels = paste(rownames(mtcars)), cex=0.65)

fonte
2014-02-24 03:54:08
_caveat_: Se stai usando 'beside = TRUE', probabilmente vorrai usare' colMeans (x) 'invece di solo' x' se vuoi una sola etichetta per gruppo. – MichaelChirico