Learn R Programming

IDPmisc (version 0.3.1)

Arrows: Pretty Open or Closed Arrows

Description

Draws a set of open or closed arrows which can be shaped by many arguments. Arrows is an extended version of p.arrows.

Usage

Arrows(x1, y1, x2, y2,
       size = 1, width = 1.2/4/cin, open = TRUE,
       sh.adj = 0.1, sh.lwd = 1,
       sh.col = if (is.R()) par("fg") else 1, sh.lty = 1,
       h.col = sh.col, h.col.bo = sh.col,
       h.lwd = 1, h.lty = 1, verbose = FALSE)

Arguments

x1, y1
Coordinates of points from which to draw.
x2, y2
Coordinates of points to which to draw.
size
Head size as a fraction of a character height.
width
Width of the arrow head. See argument verbose.
open
Defines if arrows are open or closed.
sh.adj
Defines gap between end of the shaft and the top of the head of the arrow (see details)
sh.lwd
Thickness of shaft. cf. par
sh.col
Color of shaft. cf. par
sh.lty
Line type of shaft. cf. par
h.col
Color of head.
h.col.bo
Color of border of head.
h.lwd
Line width of border of head.
h.lty
Line type of border of head.
verbose
When TRUE, the width used is returned.

Value

  • A value is only returned, when verbose == TRUE.

Details

Definition of sh.adj: [object Object],[object Object],[object Object],[object Object]

See Also

p.arrows, arrows

Examples

Run this code
## a bunch of different arrows
plot(c(0,10), c(0,10), type="n")
Arrows(5, 5, 5,10, size=3, 
       sh.lwd=5, sh.lty=2,
       h.lwd=5)
Arrows(5, 5, 7.5, 9, size=3, open=TRUE,
       sh.adj=0.7, sh.lwd=5, sh.lty=2,
       h.col.bo="red",h.lwd=5)
Arrows(5, 5, 9, 7.5, size=3, open=FALSE,    
       sh.adj=1, sh.lwd=5, sh.col="blue",
       h.col.bo="red",h.lwd=2)
Arrows(5, 5, 10, 5, size=2.5, width=1.5, open=FALSE,
       sh.adj=1, sh.lwd=7, sh.col="blue")      
Arrows(5, 5, 9, 2.5, size=4, open=FALSE,
       sh.lty=0,
       h.col.bo="black",h.lwd=5)     
Arrows(5, 5, 7.5, 1)
Arrows(5, 5, 5, 0, size=2)
Arrows(5, 5, 2.5, 1, size=2, width=1)

## vector field
x<- runif( 20)
y<- runif( 20)
u<- 0.1+0.02*rnorm(20)
v<- 0.1+0.02*rnorm(20)
plot(x,y,xlim=range(c(x,x+u)),ylim=range(c(y,y+v)),type="n")
Arrows(x,y,x+u,y+v,sh.col="blue")

Run the code above in your browser using DataLab