[R] grid command

Martin Maechler maechler at stat.math.ethz.ch
Wed Jun 30 11:04:10 CEST 1999


>>>>> On Wed, 30 Jun 1999 10:21:49 +0200, Alessandro Magni <magni at omega.ien.it> said:

    Alessandro> I'd like to know if there is a way to plot your stuff and
    Alessandro> have a grid on the plot, in which the grid falls exactly
    Alessandro> where it should, i.e. on the axis labels.  E.g., if on x
    Alessandro> axis I have the labels -4,-2,0,2,4 and on y -1,-0.5,0,0.5,1
    Alessandro> the command grid(5,5) puts the grid out of place, just on 0
    Alessandro> it falls right.  Any hint?

I didn't even remember  grid()... 
If you look at it, you see that it's a basic interface to  abline.   -> 

1st) solution:

   abline(h= y.vec, v = x.vec,  col = .., lty =.., lwd = ...)

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 ? 
  ] 

Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum SOL G1;	Sonneggstr.33
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1086			<><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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