Learn R Programming

shape (version 1.4.6.1)

Arrowhead: adds arrowheads to a plot

Description

adds one or more arrowheads to a plot; shape is either curved, a triangle, a circle or ellipse.

Usage

Arrowhead(x0, y0, angle = 0, arr.length = 0.4, 
          arr.width = arr.length/2, arr.adj = 0.5, 
          arr.type = "curved", lcol = "black", lty = 1, 
          arr.col = lcol, arr.lwd = 2, npoint = 5, ...)

Arguments

x0

x-coordinates of points at which to draw arrowhead; either one value or a vector.

y0

y-coordinates of points at which to draw arrowhead; either one value or a vector.

angle

angle of arrowhead (anti-clockwise, relative to x-axis), in degrees [0,360]; either one value or a vector.

arr.length

approximate length of arrowhead, in cm; either one value or a vector.

arr.width

approximate width of arrowhead, in cm; either one value or a vector.

arr.adj

0,0.5,1 specifying the adjustment of the arrowhead.

arr.type

type of arrowhead to draw, one of "curved", "triangle", "circle", "ellipse".

lcol

line color specifications; either one value or a vector.

lty

line type specifications; either one value or a vector.

arr.col

color of arrowhead; either one value or a vector.

arr.lwd

line width of arrowhead.

npoint

only if arr.type = "curved": number of points to draw the curve; increase for smoother arrowheads

...

arguments passed to the polygon function.

Author

Karline Soetaert <karline.soetaert@nioz.nl>

Details

x0, y0, angle, arr.length, arr.width, lcol, lty and arr.col can be a vector, of the same length.

  • if arr.adj = 0.5, then the centre of the arrowhead is at the point at which it is drawn.

  • arr.adj = 1 causes the tip of the arrowhead to touch the point.

  • arr.adj = 0 causes the base of the arrowhead to touch the point.

The type of the arrowhead is set with arr.type which can take the values:

  • "triangle": uses filled triangle

  • "curved" : draws arrowhead with curved edges

  • "circle" : draws circular head (where arr.width=arr.length)

  • "ellipse" : draws ellipsoid head

See Also

Arrows

Examples

Run this code
emptyplot(main = "Arrowhead")
Arrowhead(x0 = runif(10), y0 = runif(10), angle = runif(10)*360, 
          arr.length = 0.3, arr.type = "circle", arr.col = "green")
Arrowhead(x0 = runif(10), y0 = runif(10), angle = runif(10)*360, 
          arr.length = 0.4, arr.type = "curved", arr.col = "red")
Arrowhead(x0 = runif(10), y0 = runif(10), angle = runif(10)*360, 
          arr.length = runif(10), arr.type = "triangle", 
          arr.col = rainbow(10))

Run the code above in your browser using DataLab