Learn R Programming

broman (version 0.72-4)

arrowlocator: Use the locator function to plot an arrow

Description

Use the graphics::locator() function to indicate the endpoints of an arrow and then plot it.

Usage

arrowlocator(
  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.

...

Additional graphics parameters

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

Use graphics::locator() to indicate the two endpoints of an arrow and then draw it.

See Also

graphics::arrows(), graphics::locator()

Examples

Run this code
# NOT RUN {
plot(0,0,type="n", xlab="", ylab="", xlim=c(0,100), ylim=c(0,100))
arrowlocator(col="blue", lwd=2)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab