Draw line segments 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 be supplied.
graphical parameters as in
further graphical parameters (from
i, a line segment is drawn between the point
(x0[i], y0[i]) and the point
(x1[i], y1[i]). The
coordinate vectors will be recycled to the length of the longest.
The graphical parameters
lwd can be
vectors of length greater than one and will be recycled if necessary.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
polygon for slightly easier and less flexible line
lines for the usual polygons.
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')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.