From ligges@statistik.uni-dortmund.de  Tue Nov 12 08:44:39 2002
From: ligges@statistik.uni-dortmund.de (ligges@statistik.uni-dortmund.de)
Date: Tue, 12 Nov 2002 09:44:39 +0100 (MET)
Subject: [R] grid(): defaults of nx and ny do not correspond with axis() (PR#2282)
Message-ID: <200211120844.JAA03800@pubhealth.ku.dk>

wolfram@fischer-zim.ch wrote:
> 
> Problem:
>     When tick marks are set by axis(), the default grid() does not always
>     correspond with the tick marks, although the manual of grid() says:
>     nx,ny: ... When `NULL', as per default, the grid aligns with the
>            tick marks on the corresponding axis, when `NA', no grid
>            lines are drawn in the corresponding direction.
> 
> Example:
>     m <- 200; n <- 10; i <- 40
>     plot( 1:n, sample( 1:m, n, T ), type='b', yaxt='n' )
>     axis( side=2, at = seq( 0, m, i ), col='blue' )
>     grid( col='red', lty=2 )


I think the "bug" is a small inconsistency in the help page. With the
current design of axis() and par() it's not (at least not easily)
possible to make grid() that intelligent. For these cases the help page
tells us: "If more fine tuning is required, use abline(h = ., v = .)
directly."

To fix the "bug", I suggest a clarification in ?grid by inserting a few
words in the sentence you are citing, e.g.:
"When `NULL', as per default, the grid aligns with the tick marks on the
corresponding \emph{default} axis (i.e. tickmarks as computed by
axTicks()), [...]".

Uwe Ligges

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[R] grid(): defaults of nx and ny do not correspond with axis() (PR#2282)
ligges@statistik.uni-dortmund.de