segments(x1, y1, x2, y2) arrows(x1, y1, x2, y2, size=.2, open=F, rel=F)
Graphical parameters may also be supplied as arguments to this function (see par).
# draw arrows from ith to i+1st points s <- seq(length(x)-1) # sequence one shorter than x arrows(x[s], y[s], x[s+1], y[s+1])# a function to make plots with error bars errorbar <- function(x, y, plusmin) { plot(x, y, ylim = c(min(y - plusmin), max(y + plusmin))) segments(x, y + plusmin, x, y - plusmin) }