The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Kickstarting R
Text in the margins

Staggered axis labels

Monday, Tuesday,... oops, the X axis is beginning to look like a mess. When you have one or more long labels on the axis, they can run together unless you squash the font down to an unreadable size or stagger the labels. Using one of the variables in the previous example, try this.

> upvar<-rnorm(10)+seq(1,1.9,by=0.1)
> plot(upvar,pch=1,col=3,axes=F)
> box()
> axis(at=2)
> axis(1,at=1:10,labels=F)
> nnames<-c("one","two","three","four","five","six","seven","eight","nine","ten")
> mtext(nnames,1,at=1:10,line=rep(c(1,2),5))

First plot the data with no axes at all, then add the box and the ordinate. The second call to axis() just makes the tick marks where we want them. I've assigned the labels to a character vector to make it easier to see what's going on here. mtext() then places the ten labels on alternate lines, staggering them. You may want to add space for an extra line to the bottom of the plot if you think it will look better.

Back to Table of Contents

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.