[R] xaxp and grid()

Daniel Mastropietro mastropi at uwalumni.com
Wed Jun 26 21:57:35 CEST 2002


Thank you for the answer.
But I think something like this should be noted in the help pages. I mean 
the fact that the option 'xaxp' in the plot function does not have any 
effect because the plot function recomputes its value. And that the 
par(xaxp=...) together with the axis() function should be used after the 
plot function in order to set the desired axis tickmarks.
Unless this is a bug in the plot function...

Also, as a general note, I would like to give a constructive suggestion, 
namely that in the future the names of parameter options be more 
informative. In many cases it is hard to intuitively guess and, more 
importantly to remember, what they are used for.

Regards.
Daniel Mastropietro

At 08:30 AM 26/6/2002 +0200, Uwe Ligges wrote:
>Daniel Mastropietro wrote:
> >
> > Hello,
> >
> > I use the option xaxp in the plot function and it is not recognized.
> > This affects the result of the function grid(), since it takes the default
> > tick marks used by the plot function, which is not what I want.
> >
> > See for example the result of:
> >
> > plot(1:10,1:10,xaxp=c(1,10,9))
> > grid(9);
>
>plot sets par("xaxp") itself. You can change it before calling grid()
>(and after plot() has set it) as follows:
>
>  plot(1:10)
>  par(xaxp = c(1, 10, 9))
>  grid(9)
>
>If you want to have tickmarks analogously, you have to create the axis
>manually:
>
>  plot(1:10, xaxt = "n")
>  axis(1, 1:10)
>  par(xaxp = c(1, 10, 9))
>  grid(9)
>
>Or just create the grid with abline():
>
>  plot(1:10, xaxt = "n")
>  axis(1, 1:10)
>  abline(v = 1:10, h = seq(2, 10, 2), col = "grey")
>
>Uwe Liges

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list