treearrow function

adds a dendrogram-like branched arrow between several points

adds a dendrogram-like branched arrow between several points

connects two sets of points with a dendrogram-like structure,

adds an arrowhead at a certain distance.

treearrow(from, to, lwd = 2, lty = 1, lcol = "black", arr.col = lcol, arr.side = 2, arr.pos = 0.5, line.pos = 0.5, path = "H", ...)

Arguments

  • from: matrix of coordinates (x,y) of points from which to draw arrow.
  • to: matrix of coordinates (x,y) of points to which to draw arrow.
  • lwd: line width.
  • lty: line type.
  • lcol: line color.
  • arr.col: arrow color.
  • arr.side: segment number on which arrowhead is drawn (1,2).
  • arr.pos: relative position of arrowhead on segment on which arrowhead is drawn.
  • line.pos: relative position of (horizontal/vertical) line.
  • path: Vertical, Horizontal.
  • ...: other arguments passed to function straightarrow .

Returns

coordinates (x,y) where arrowhead is drawn

Author(s)

Karline Soetaert karline.soetaert@nioz.nl

Examples

openplotmat(main = "treearrow") pos <- coordinates(c(3, 2, 4, 1)) treearrow(from = pos[1:5, ], to = pos[6:10, ]) for (i in 1:10) textrect(pos[i, ], lab = i, cex = 2, radx = 0.05) openplotmat(main = "treearrow") pos <- coordinates(c(2, 4), hor = FALSE) treearrow(from = pos[1:2, ], to = pos[3:6, ], arr.side = 1:2, path = "V") for (i in 1:6) textrect(pos[i, ], lab = i, cex = 2, radx = 0.05) openplotmat(main = "treearrow") pos <- coordinates(c(3, 5, 7, 7, 5, 3)) treearrow(from = pos[1:15, ], to = pos[15:30, ], arr.side = 0) for (i in 1:30) textrect(pos[i, ], lab = i, cex = 1.2, radx = 0.025)

Details

a tree-shaped arrow is drawn between points '(from, to)', where both from and to can be several points.

How the segments are drawn is set with path which can take on the values:

  • "H": (horizontal): first left or right.
  • "V": (vertical): first down- or upward.

The segment(s) on which the arrow head is drawn is set with arr.side, which is one or more values in (1, 2)

The position of the arrowhead on the segment on which it is drawn, is set with arr.pos, a value between 0(start of segment) and 1(end of segment)

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

  • "none" : skips the drawing of arrows.
  • "simple" : uses comparable function arrows .
  • "triangle": uses filled triangle.
  • "curved" : draws arrowhead with curved edges.
  • "circle" : draws circular head.
  • "ellipse" : draws ellepsoid head.
  • "T" : draws T-shaped (blunt) head.

The size of the arrow head can be specified with the arguments arr.length and arr.width.

See Arrowhead from package shape for details on arrow head.

See Also

straightarrow, segmentarrow, curvedarrow, selfarrow, bentarrow, splitarrow,

arrows: the comparable R function,

Arrows: more complicated arrow function from package shape.

  • Maintainer: Karline Soetaert
  • License: GPL (>= 2)
  • Last published: 2020-09-30

Useful links