segmentarrow: adds 3-segmented arrow between two points.

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

Description

Connects two points with 3 segments (default = left-vertical-right) and adds an arrowhead on one of the segments at a certain distance

Usage

1
2
3
segmentarrow(from, to, lwd = 2, lty = 1, lcol = "black", 
             arr.col = lcol, arr.side = 2, arr.pos = 0.5, 
             path = "LVR", dd = 0.5, ...)

Arguments

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.

Details

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:

  • "LVR": first left then vertical then right.

  • "RVL": first right then vertical then left.

  • "UHD": first up then horizontal then down.

  • "DHU": first down then horizontal then up.

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:

  • "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, bentarrow, curvedarrow, selfarrow, treearrow, splitarrow,

arrows: the comparable R function,

Arrows: more complicated arrow function from package shape

try: demo(plotweb)

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
25
26
27
28
29
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")


Search within the diagram package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.