treearrow {diagram}R Documentation

adds a dendrogram-like branched arrow between several points

Description

connects two sets of points with a dendrogram-like structure,
adds an arrowhead at a certain distance

Usage

treearrow(from, to, lwd=2, lty=1, lcol="black",
   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.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

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:

  • "simple" : uses comparable R function arrows
  • "triangle": uses filled triangle
  • "curved" : draws arrowhead with curved edges
  • "circle" : draws circular head

    see Arrowhead from package shape for details on arrow head

    Value

    coordinates (x,y) where arrowhead is drawn

    Author(s)

    Karline Soetaert <k.soetaert@nioo.knaw.nl>

    See Also

    straightarrow, segmentarrow, curvedarrow selfarrow, bentarrow, splitarrow,
    arrows: the comparable R function,
    Arrows: more complicated arrow function from package shape

    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)

    [Package diagram version 1.1 Index]