Add Arrows to a Plot
Draw arrows between pairs of points.
1 2 3
coordinates of points from which to draw.
coordinates of points to which to draw. At least one must the supplied
length of the edges of the arrow head (in inches).
angle from the shaft of the arrow to the edge of the arrow head.
integer code, determining kind of arrows to be drawn.
graphical parameters, possible vectors.
graphical parameters such as
i, an arrow is drawn between the point
y0[i]) and the point
(x1[i], y1[i]). The coordinate vectors
will be recycled to the length of the longest.
code = 1 an arrowhead is drawn at
(x0[i], y0[i]) and if
code = 2 an arrowhead is drawn at
(x1[i], y1[i]). If
code = 3 a head is drawn at both ends of the arrow. Unless
length = 0, when no head is drawn.
The graphical parameters
can be vectors of length greater than one and will be recycled if
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.
The first four arguments in the comparable S function are named
x1, y1, x2, y2.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
segments to draw segments.
1 2 3 4 5 6 7 8
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")
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.