[R] grid command

Paul Murrell pm254 at medschl.cam.ac.uk
Thu Jul 1 09:12:58 CEST 1999


>2nd) solution, more closely linked with asking for
>    ``grid where the labels are'' : Use the "tck"  par() :
>   plot(1:10,axes=F, frame=T)
>   axis(1, at=1:10, tck = 1)
>   axis(2, at=2*(1:5), tck=1)
>  However, I don't think you can set `col', 'lty',... of these
>  [--> Do we need more  par()s , such as   col.tck, lwd.tck, lty.tck ,
>      or at least new axis arguments ?   Paul ?
>  ]

i would prefer to avoid even more par()s.

i think the abline() solution is the best for doing what grid() won't.  like
you say, grid() is just a simple front-end to abline().

it is possible to control other par()s via axis().  specifically ...

axis(1, tck=1, lwd=?, lty=?)

... works as you might expect, although getting colour is a bit unintuitive

axis(1, tck=1, fg=?)

the problem with this solution is that the whole axis (actually, NOT the
labels, but  importantly NOT JUST the tick-marks), is affected.  also, you
have to draw another axis if you want the normal tick-marks as well as the
grid lines.

hence, i would go for abline().


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