
Last chance! 50% off unlimited learning
Sale ends in
grid
adds an nx
by ny
rectangular grid to an
existing plot.
grid(nx = NULL, ny = nx, col = "lightgray", lty = "dotted",
lwd = par("lwd"), equilogs = TRUE)
character or (integer) numeric; color of the grid lines.
character or (integer) numeric; line type of the grid lines.
non-negative numeric giving line width of the grid lines.
logical, only used when log coordinates and
alignment with the axis tick marks are active. Setting equilogs =
FALSE
in that case gives non equidistant tick aligned
grid lines.
Murrell, P. (2005) R Graphics. Chapman & Hall/CRC Press.
# NOT RUN {
plot(1:3)
grid(NA, 5, lwd = 2) # grid only in y-direction
## maybe change the desired number of tick marks: par(lab = c(mx, my, 7))
op <- par(mfcol = 1:2)
with(iris,
{
plot(Sepal.Length, Sepal.Width, col = as.integer(Species),
xlim = c(4, 8), ylim = c(2, 4.5), panel.first = grid(),
main = "with(iris, plot(...., panel.first = grid(), ..) )")
plot(Sepal.Length, Sepal.Width, col = as.integer(Species),
panel.first = grid(3, lty = 1, lwd = 2),
main = "... panel.first = grid(3, lty = 1, lwd = 2), ..")
}
)
par(op)
# }
Run the code above in your browser using DataLab