axis.srt | R Documentation |
axis.srt Extend generic axis() function with rotation of labels (string rotation, srt). If labels on the x-axis are parallel, then they are center justified; otherwise they are right-justified.
axis.srt(side, at, labels, srt, offset = 0.05, cex = 1, ...)
side: |
an integer specifying which side of the plot the axis is placed as follows: 1=below, 2=left, 3=above and 4=right. |
at: |
the points at which tick-marks are to bve drawn. |
labels: |
a character vector of labels. |
srt: |
string rotation in degrees, where 0 is horizontal |
offset: |
distance to draw labels relative to axis, scaled to dimensions of plot region. |
cex: |
character expansion factor for axis labels |
...: |
other arguments passed to axis(), *e.g.*, 'line' or 'col' |
par(mar=c(5,5,5,5), xpd=FALSE)
boxplot(split(iris$Sepal.Length, iris$Species), xaxt='n')
axis.srt(side=1, at=1:3, labels=levels(iris$Species), srt=30)
axis.srt(side=3, at=1:3, labels=levels(iris$Species), srt=-30)
# draw horizontally instead
boxplot(split(iris$Petal.Length, iris$Species), horizontal=TRUE, yaxt='n')
axis.srt(side=2, at=1:3, labels=levels(iris$Species), srt=-30)
axis.srt(side=4, at=1:3, labels=levels(iris$Species), srt=30)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.