Learn R Programming

Ecfun (version 0.2-2)

Arrows: Draw arrows between pairs of points.

Description

Generalizes graphics::arrows to allow all arguments to be vectors. (As of R 3.1.0, only the first component of the length argument is used by graphics::arrows; others are ignored without a warning.)

Usage

Arrows(x0, y0, x1 = x0, y1 = y0, length = 0.25, angle = 30,
       code = 2, col = par("fg"), lty = par("lty"),
       lwd = par("lwd"), warnZeroLength=FALSE, ...)

Arguments

x0, y0, x1, y1, length, angle, code, col, lty, lwd, ...

as for arrows.

warnZeroLength

Issue a warning for zero length arrow? arrow does; skip if FALSE.

Details

1. Put all arguments in a data.frame to force them to shared length.

2. Call arrows once for each row.

See Also

arrows

Examples

Run this code
# NOT RUN {
##
## 1. Simple example: 
##    3 arrows, the first with length 0 is suppressed 
##
plot(1:3, type='n')
Arrows(1, 1, c(1, 2, 2), c(1, 2:3), col=1:3, length=c(1, .2, .6))

##
## 2.  with an NA
##
plot(1:3, type='n')
Arrows(1, 1, c(1, 2, 2), c(1, 2, NA), col=1:3, length=c(1, .2, .6))

# }

Run the code above in your browser using DataLab