treearrow: adds a dendrogram-like branched arrow between several points

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/treearrow.R

Description

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

adds an arrowhead at a certain distance.

Usage

1
2
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.

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:

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:

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.

Value

coordinates (x,y) where arrowhead is drawn

Author(s)

Karline Soetaert <karline.soetaert@nioz.nl>

See Also

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

arrows: the comparable R function,

Arrows: more complicated arrow function from package shape.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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)

diagram documentation built on Oct. 23, 2020, 5:46 p.m.