[R] change tick spacing on the axis of a plot.

Jim Lemon jim at bitwrit.com.au
Fri Sep 24 12:04:06 CEST 2010


On 09/24/2010 05:42 PM, skan wrote:
>
> Hello
>
> How can I change the spacing of tick marks on the axis a plot?
> What parameters should I use on base plot or on rgl?
>
Hi skan,
The usual way this is done is to suppress the axes in the plot:

plot(...,axes=FALSE)

and then add the axes individually:

axis(1,at=1:8,labels=1:8)
axis(2,at=seq(0,70,by=10),labels=seq(0,70,by=10))
box()

If you try to place the labels too closely, some of them will not be 
displayed. You can get around that by specifying empty labels:

axis(1,at=1:10,labels=rep("",10))

and then using the mtext function to add the labels to the ticks.

Jim



More information about the R-help mailing list