adds 2-segmented arrow between two points

Share:

Description

Connects two points with 2 segments (default = horizontal-vertical) and adds an arrowhead on (one of) the segments and at a certain distance.

Usage

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

Arguments

from

coordinates (x,y) of the point *from* which to draw arrow.

to

coordinates (x,y) of the point *to* which to draw arrow.

lwd

line width.

lty

line type.

lcol

line color.

arr.col

arrowhead 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.

path

first segment to be drawn (V=Vertical, H=Horizontal).

...

other arguments passed to function straightarrow.

Details

a two-segmented arrow is drawn between two points '(from, to)'

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

  • H: (horizontal): first left or right, then vertical.

  • V: (vertical) : first down- or upward, then horizontal.

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.

  • "ellipse" : draws ellepsoid head

  • "T" : draws T-shaped (blunt) head

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, treearrow, 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
19
20
openplotmat(main = "bentarrow")

pos <- cbind( A <- seq(0.1, 0.9, by = 0.2), rev(A))

text(pos, LETTERS[1:5], cex = 2)

for (i in 1:4) 
  bentarrow(from = pos[i,] + c(0.05, 0), to = pos[i+1,] + c(0, 0.05),
            arr.pos = 1, arr.adj = 1)

for (i in 1:2) 
  bentarrow(from = pos[i,] + c(0.05, 0), to = pos[i+1, ] + c(0, 0.05),
            arr.pos = 0.5, path = "V", lcol = "lightblue", 
            arr.type = "triangle")

bentarrow(from = pos[3, ] + c(0.05, 0), to = pos[4, ] + c(0, 0.05),
          arr.pos = 0.7, arr.side = 1, path = "V", lcol = "darkblue")

bentarrow(from = pos[4, ] + c(0.05, 0), to = pos[5, ] + c(0, 0.05),
          arr.pos = 0.7, arr.side = 1:2, path = "V", lcol = "blue")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.