[R] problems with axis

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Nov 20 08:50:22 CET 2006

On Sun, 19 Nov 2006, nelson - wrote:

> hi list!
> i'm plotting a probit plot .On x axis i have value of a statistical
> variable. on y axis the corresponding normalized representation. I
> have this code
>   plot(vals,perc,axes=F,col="red",pch=19,cex=0.25)
>    probit.scale.values <-
> c(0,0.001,0.01,0.05,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,0.95,0.99,0.999,1)
>    probit.scale.at <- qnorm(probit.scale.values)
>    probit.scale.labels <- format(probit.scale.values,digits=3)
>    axis(2,at=probit.scale.at,labels=probit.scale.values,las=1)
>    axis(1)
>    grid()
> now the grid is misplaced. How can i set up where ticks have to be
> plotted? Here it seems the grid isn't affected by the axis() call...

It is not supposed to be: please do read the help page for grid (as the 
posting guide asked you to before posting).

If your intention is to have a grid at the axis tick marks, consult ?par 
and in particular parameter 'tck', and use axis and not grid.

> Another question: how can i set up a subtick division in another color
> and plotting the relative grid on the same plot (like major and minor
> tick)?

Use axis twice (or more).

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list