EVOLUTION-MANAGER
Edit File: grid.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Add Grid to a Plot</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for grid {graphics}"><tr><td>grid {graphics}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Add Grid to a Plot</h2> <h3>Description</h3> <p><code>grid</code> adds an <code>nx</code> by <code>ny</code> rectangular grid to an existing plot. </p> <h3>Usage</h3> <pre> grid(nx = NULL, ny = nx, col = "lightgray", lty = "dotted", lwd = par("lwd"), equilogs = TRUE) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>nx, ny</code></td> <td> <p>number of cells of the grid in x and y direction. When <code>NULL</code>, as per default, the grid aligns with the tick marks on the corresponding <em>default</em> axis (i.e., tickmarks as computed by <code><a href="axTicks.html">axTicks</a></code>). When <code><a href="../../base/html/NA.html">NA</a></code>, no grid lines are drawn in the corresponding direction.</p> </td></tr> <tr valign="top"><td><code>col</code></td> <td> <p>character or (integer) numeric; color of the grid lines.</p> </td></tr> <tr valign="top"><td><code>lty</code></td> <td> <p>character or (integer) numeric; line type of the grid lines.</p> </td></tr> <tr valign="top"><td><code>lwd</code></td> <td> <p>non-negative numeric giving line width of the grid lines.</p> </td></tr> <tr valign="top"><td><code>equilogs</code></td> <td> <p>logical, only used when <em>log</em> coordinates and alignment with the axis tick marks are active. Setting <code>equilogs = FALSE</code> in that case gives <em>non equidistant</em> tick aligned grid lines.</p> </td></tr> </table> <h3>Note</h3> <p>If more fine tuning is required, use <code><a href="abline.html">abline</a>(h = ., v = .)</code> directly. </p> <h3>References</h3> <p>Murrell, P. (2005) <em>R Graphics</em>. Chapman & Hall/CRC Press. </p> <h3>See Also</h3> <p><code><a href="plot.html">plot</a></code>, <code><a href="abline.html">abline</a></code>, <code><a href="lines.html">lines</a></code>, <code><a href="points.html">points</a></code>. </p> <h3>Examples</h3> <pre> 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) </pre> <hr /><div style="text-align: center;">[Package <em>graphics</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>