The R Project SVN R

Rev

Rev 61153 | Rev 84816 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61153 Rev 61168
Line 13... Line 13...
13
\usage{
13
\usage{
14
grid(nx = NULL, ny = nx, col = "lightgray", lty = "dotted",
14
grid(nx = NULL, ny = nx, col = "lightgray", lty = "dotted",
15
     lwd = par("lwd"), equilogs = TRUE)
15
     lwd = par("lwd"), equilogs = TRUE)
16
}
16
}
17
\arguments{
17
\arguments{
18
  \item{nx,ny}{number of cells of the grid in x and y direction.  When
18
  \item{nx, ny}{number of cells of the grid in x and y direction.  When
19
    \code{NULL}, as per default, the grid aligns with the tick marks on
19
    \code{NULL}, as per default, the grid aligns with the tick marks on
20
    the corresponding \emph{default} axis (i.e., tickmarks as computed by
20
    the corresponding \emph{default} axis (i.e., tickmarks as computed by
21
    \code{\link{axTicks}}).  When \code{\link{NA}}, no grid lines are
21
    \code{\link{axTicks}}).  When \code{\link{NA}}, no grid lines are
22
    drawn in the corresponding direction.}
22
    drawn in the corresponding direction.}
23
  \item{col}{character or (integer) numeric; color of the grid lines.}
23
  \item{col}{character or (integer) numeric; color of the grid lines.}
Line 41... Line 41...
41
}
41
}
42
\examples{
42
\examples{
43
plot(1:3)
43
plot(1:3)
44
grid(NA, 5, lwd = 2) # grid only in y-direction
44
grid(NA, 5, lwd = 2) # grid only in y-direction
45
 
45
 
46
## maybe change the desired number of tick marks:  par(lab = c(mx,my,7))
46
## maybe change the desired number of tick marks:  par(lab = c(mx, my, 7))
47
op <- par(mfcol = 1:2)
47
op <- par(mfcol = 1:2)
48
with(iris,
48
with(iris,
49
     {
49
     {
50
     plot(Sepal.Length, Sepal.Width, col = as.integer(Species),
50
     plot(Sepal.Length, Sepal.Width, col = as.integer(Species),
51
          xlim = c(4, 8), ylim = c(2, 4.5), panel.first = grid(),
51
          xlim = c(4, 8), ylim = c(2, 4.5), panel.first = grid(),
52
          main = "with(iris,  plot(...., panel.first = grid(), ..) )")
52
          main = "with(iris,  plot(...., panel.first = grid(), ..) )")
53
     plot(Sepal.Length, Sepal.Width, col = as.integer(Species),
53
     plot(Sepal.Length, Sepal.Width, col = as.integer(Species),
54
          panel.first = grid(3, lty = 1,lwd = 2),
54
          panel.first = grid(3, lty = 1, lwd = 2),
55
          main = "... panel.first = grid(3, lty = 1,lwd = 2), ..")
55
          main = "... panel.first = grid(3, lty = 1, lwd = 2), ..")
56
     }
56
     }
57
    )
57
    )
58
par(op)
58
par(op)
59
 
59
 
60
}
60
}