Last data update: 2014.03.03

R: Draw arrows between pairs of points.
ArrowsR Documentation

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.

Author(s)

Spencer Graves

See Also

arrows

Examples

##
## 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))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Ecfun)

Attaching package: 'Ecfun'

The following object is masked from 'package:base':

    sign

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Ecfun/Arrows.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Arrows
> ### Title: Draw arrows between pairs of points.
> ### Aliases: Arrows
> ### Keywords: aplot
> 
> ### ** Examples
> 
> ##
> ## 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))
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>