Learn R Programming

shipunov (version 1.0)

Draw.arrow: Add arrow to the plot interactively

Description

Add arrow to the plot interactively

Usage

Draw.arrow(reverse=FALSE, horizontal=FALSE, vertical=FALSE, length=0.1, ...)

Arguments

reverse

If FALSE, first indicate the tail of the arrow and then the head; if TRUE, first indicate the head of the arrow and then the tail.

horizontal

If TRUE, force the arrow to be horizontal; use the average y-axis value of the two clicks for the vertical placement.

vertical

If TRUE, force the arrow to be vertical; use the average x-axis value of the two clicks for the horizontal placement.

length

Length of the edges of the arrow head.

...

arguments to 'arrows()'

Value

The locations of the endpoints of the arrow, as a two-row matrix. The first row indicates the location of the tail of the arrow; the second row indicates the location of the head of the arrow.

Details

'Draw.arrow()' adds arrow to the plot interactively. Based on analogous Karl W Broman function. Uses the 'locator()' function to plot an arrow.

See Also

locator

Examples

Run this code
# NOT RUN {
plot(1:20)
# }
# NOT RUN {
## interactive command:
Draw.arrow(col="red", lwd=2)
# }

Run the code above in your browser using DataLab