\Header{grid}{Add Grid to a Plot}
\keyword{aplot}{grid}
\begin{Description}\relax
\code{grid} adds an \code{nx} by \code{ny} rectangular grid to an
existing plot, using lines of type \code{lty} and color \code{col}.

If more fine tuning is required, use \code{\Link{abline}(h = ., v = .)}
directly.\end{Description}
\begin{Usage}
\begin{verbatim}
grid(nx = NULL, ny = NULL, col = "lightgray", lty = "dotted")
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{nx,ny}] number of cells of the grid in x and y direction.
Defaults to the number of tick marks on the corresponding axis.
\item[\code{col}] character or (integer) numeric; color of the grid lines.
\item[\code{lty}] character or (integer) numeric; line type of the grid lines.
\end{ldescription}
\end{Arguments}
\begin{SeeAlso}\relax
\code{\Link{plot}}, \code{\Link{abline}}, \code{\Link{lines}},
\code{\Link{points}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
data(iris)
## maybe change the desired number of tick marks:  par(lab=c(mx,my,7))
plot(iris$Sepal.L, iris$Sepal.W, col = rep(1:3, rep(50, 3)),
     xlim = c(4, 8), ylim = c(2, 4.5), panel.first = grid())
\end{ExampleCode}
\end{Examples}

