adds 3-segmented arrow between two points.
Connects two points with 3 segments (default = left-vertical-right) and adds an arrowhead on one of the segments at a certain distance
segmentarrow(from, to, lwd = 2, lty = 1, lcol = "black", arr.col = lcol, arr.side = 2, arr.pos = 0.5, path = "LVR", dd = 0.5, ...)
from
: coordinates (x,y) of point from which to draw arrow.to
: coordinates (x,y) of point 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,3).arr.pos
: relative position of arrowhead on segment on which arrowhead is drawn.path
: outline of the 3 segments, default: left, vertical, right.dd
: length of segment arm, directed away from endpoints....
: arguments passed to function straightarrow .coordinates (x,y) where arrowhead is drawn
Karline Soetaert karline.soetaert@nioz.nl
openplotmat(main="segmentarrow") pos <-cbind(A <- seq(0.2, 0.8, by = 0.2), rev(A)) text(pos, LETTERS[1:4], cex = 2) segmentarrow(from = pos[1, ] + c(0, 0.05), to = pos[2, ] + c(0, 0.05), arr.pos = 1, arr.adj = 1, dd = 0.1, path = "UHD", lcol = "darkred") segmentarrow(from = pos[2, ] + c(-0.05, 0), to = pos[3, ] + c(-0.05, 0.01), arr.pos = 1, arr.adj = 1, dd = 0.1, lcol = "black", arr.type = "triangle") segmentarrow(from = pos[2, ] + c(0.05, 0), to = pos[3, ] + c(0.05, 0.01), arr.pos = 0.5, dd = 0.3, path = "RVL", arr.side = 1, lcol = "lightblue", arr.type = "simple") segmentarrow(from = pos[3, ] + c(0.05, 0), to = pos[4, ] + c(-0.05, 0.01), arr.pos = 0.5, dd = 0.05, path = "RVL", lcol = "darkblue", arr.type = "ellipse") segmentarrow(from = pos[3, ] + c(0, -0.05), to = pos[4, ] + c(0, 0.05), arr.pos = 0.5, arr.side = 3, dd = 0.05, path = "DHU", lcol = "darkgreen") segmentarrow(from = pos[3,] + c(-0.05, -0.05), to = pos[4, ] + c(0, -0.05), arr.pos = 0.5, arr.side = 1:3, dd = 0.3, path = "DHU", lcol = "green")
one 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, 3).
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
, bentarrow
, curvedarrow
, selfarrow
, treearrow
, splitarrow
,
arrows
: the comparable R function,
Arrows
: more complicated arrow function from package shape
try: demo(plotweb)
Useful links