adds 2-segmented arrow between two points
Connects two points with 2 segments (default = horizontal-vertical) and adds an arrowhead on (one of) the segments and at a certain distance.
bentarrow(from, to, lwd = 2, lty = 1, lcol = "black", arr.col = lcol, arr.side = 2, arr.pos = 0.5, path = "H", ...)
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.coordinates (x,y) where arrowhead is drawn
Karline Soetaert karline.soetaert@nioz.nl
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")
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:
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.
straightarrow
, segmentarrow
, curvedarrow
, selfarrow
, treearrow
, splitarrow
,
arrows
: the comparable R function,
Arrows
: more complicated arrow function from package shape.
Useful links