% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/common.R
\name{add.grid}
\alias{add.grid}
\title{add.grid}
\usage{
add.grid(
  mode = "xy",
  fg.col = "white",
  bg.col = "ivory2",
  lwd.major = 3,
  lwd.minor = 1,
  bty = "o"
)
}
\arguments{
\item{mode:}{'xy' displays both horizontal and vertical lines, 'x' horizontal only
and 'y' vertical only.  Any string without 'x' or 'y' gives plain background.}

\item{fg.col:}{colour for grid lines in foreground}

\item{bg.col:}{colour for grid background}

\item{lwd.major:}{line width for major grid lines}

\item{lwd.minor:}{line width for minor grid lines.  Set to 0 to suppress.}
}
\description{
\code{add.grid} draws a filled background in the plot region and 
lines for the major and minor ticks, in the style of ggplot2.  Because 
generic plot drawing adds objects in layers, \code{add.grid} should be called
*after* drawing an empty plot region, and *before* adding any points or lines.
}
\examples{
x <- rnorm(100)
y <- rnorm(100)
plot(NA, xlim=range(x), ylim=range(y))  # prepare empty plot
add.grid()
points(x, y, pch=21, bg='white')  # now draw the data

}
