EVOLUTION-MANAGER
Edit File: arrows.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 Arrows 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 arrows {graphics}"><tr><td>arrows {graphics}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Add Arrows to a Plot</h2> <h3>Description</h3> <p>Draw arrows between pairs of points. </p> <h3>Usage</h3> <pre> arrows(x0, y0, x1 = x0, y1 = y0, length = 0.25, angle = 30, code = 2, col = par("fg"), lty = par("lty"), lwd = par("lwd"), ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x0, y0</code></td> <td> <p>coordinates of points <b>from</b> which to draw.</p> </td></tr> <tr valign="top"><td><code>x1, y1</code></td> <td> <p>coordinates of points <b>to</b> which to draw. At least one must the supplied</p> </td></tr> <tr valign="top"><td><code>length</code></td> <td> <p>length of the edges of the arrow head (in inches).</p> </td></tr> <tr valign="top"><td><code>angle</code></td> <td> <p>angle from the shaft of the arrow to the edge of the arrow head.</p> </td></tr> <tr valign="top"><td><code>code</code></td> <td> <p>integer code, determining <em>kind</em> of arrows to be drawn.</p> </td></tr> <tr valign="top"><td><code>col, lty, lwd</code></td> <td> <p><a href="par.html">graphical parameters</a>, possible vectors. <code>NA</code> values in <code>col</code> cause the arrow to be omitted.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p><a href="par.html">graphical parameters</a> such as <code>xpd</code> and the line characteristics <code>lend</code>, <code>ljoin</code> and <code>lmitre</code>: see <code><a href="par.html">par</a></code>.</p> </td></tr> </table> <h3>Details</h3> <p>For each <code>i</code>, an arrow is drawn between the point <code>(x0[i], y0[i])</code> and the point <code>(x1[i], y1[i])</code>. The coordinate vectors will be recycled to the length of the longest. </p> <p>If <code>code = 1</code> an arrowhead is drawn at <code>(x0[i], y0[i])</code> and if <code>code = 2</code> an arrowhead is drawn at <code>(x1[i], y1[i])</code>. If <code>code = 3</code> a head is drawn at both ends of the arrow. Unless <code>length = 0</code>, when no head is drawn. </p> <p>The <a href="par.html">graphical parameters</a> <code>col</code>, <code>lty</code> and <code>lwd</code> can be vectors of length greater than one and will be recycled if necessary. </p> <p>The direction of a zero-length arrow is indeterminate, and hence so is the direction of the arrowheads. To allow for rounding error, arrowheads are omitted (with a warning) on any arrow of length less than 1/1000 inch. </p> <h3>Note</h3> <p>The first four arguments in the comparable S function are named <code>x1, y1, x2, y2</code>. </p> <h3>References</h3> <p>Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) <em>The New S Language</em>. Wadsworth & Brooks/Cole. </p> <h3>See Also</h3> <p><code><a href="segments.html">segments</a></code> to draw segments. </p> <h3>Examples</h3> <pre> x <- stats::runif(12); y <- stats::rnorm(12) i <- order(x, y); x <- x[i]; y <- y[i] plot(x,y, main = "arrows(.) and segments(.)") ## draw arrows from point to point : s <- seq(length(x)-1) # one shorter than data arrows(x[s], y[s], x[s+1], y[s+1], col = 1:3) s <- s[-length(s)] segments(x[s], y[s], x[s+2], y[s+2], col = "pink") </pre> <hr /><div style="text-align: center;">[Package <em>graphics</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>