ligges@statistik.uni-dortmund.de
2002-Nov-12 08:44 UTC
[R] grid(): defaults of nx and ny do not correspond with axis() (PR#2282)
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._