splitarrow: adds a branched arrow between several points

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

View source: R/splitarrow.R

Description

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

Usage

1
2
splitarrow(from, to, lwd = 2, lty = 1, lcol = "black", arr.col = lcol, 
           arr.side = 2, arr.pos = 0.5, centre = NULL, dd = 0.5, ...)

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.

centre

coordinates (x,y) of central point.

dd

relative position of central point, only when centre=NULL.

...

other arguments passed to function straightarrow.

Details

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

The arrow segments radiate into a central point. Either the (x,y) coordinates of this central point are set with centre or it is estimated at a certain distance (dd >0,<1) between the centroid of the *from* points and the centroid of the *to* points.

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 arrowheads are drawn

Author(s)

Karline Soetaert <karline.soetaert@nioz.nl>

See Also

straightarrow, segmentarrow, curvedarrow, selfarrow, bentarrow, treearrow,

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
19
20
21
22
23
24
openplotmat(main = "splitarrow")

pos <- coordinates(c(1, 2, 2, 4, 1))
splitarrow(from = pos[1, ], to = pos[2:10, ], 
           arr.side = 1, centre = c(0.5, 0.625))
for (i in 1:10) 
  textrect(pos[i, ], lab = i, cex = 2, radx = 0.05)
  
  
openplotmat(main = "splitarrow")

pos <- coordinates(c(1, 3))
splitarrow(from = pos[1,], to = pos[2:4, ], arr.side = 1)
splitarrow(from = pos[1,], to = pos[2:4, ], arr.side = 2)
for (i in 1:4) 
  textrect(pos[i, ], lab = i, cex = 2, radx = 0.05)
  

openplotmat(main = "splitarrow")
pos <- coordinates(N = 6)
pos <- rbind(c(0.5, 0.5), pos)
splitarrow(from = pos[1, ], to = pos[2:7, ], arr.side = 2)
for (i in 1:7)
  textrect(pos[i, ], lab = i, cex = 2, radx = 0.05)

Example output

Loading required package: shape

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