[R] grid() problems in plot(log="y")

Dirk F. Raetzel raetzel at Mathematik.Uni-Marburg.de
Mon Aug 7 19:20:33 CEST 2000


I have problems with grids using logscale on the y-axis.

Using logscale, the parameter par("yaxp")[3] seems to be negative. 
Therefore, calling grid() with no parameters gives an error
message in the seq()-call of grid(). (Bug?).  
[Running R 1.1.0 sparc-sun-solaris2.7]

But even knowing the number of tick marks is of no help, since the
location of tick marks does not seem to be allocated very regularly (for
different data). Only in a few cases a call to grid() with an approbiate
value for ny would generate the grid lines on the right places. 
Is there any possibility to get the locations of the
plotted tickmarks, so that one could plot the grid easily by direct calls
of a lines-command? (Otherwise I might have to draw my axes with the

> plot(seq(1,9), log="y", panel.first=grid(ny=3))
works perfect, whereas

> plot(seq(1,10), log="y", panel.first=grid(ny=3))
plots the grid lines at the wrong places

> plot(seq(1,10), log="y", axes=FALSE, panel.first=grid(ny=0),
+      frame.plot=T)
> axis(1)
> axis(2, c(1,2,4,8))
> abline(h=c(1,2,4,8), col="lightgray", lty="dotted")
gives the desired plot, but one have to think about the scaling of the


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