click_shape: Add shapes interactively in base 'R' graphics

Description Usage Arguments See Also Examples

View source: R/plot_extra.R

Description

Add shapes anywhere in a plot (including margins) with mouse click(s).

Usage

1
2
click_shape(shape = c("circle", "arrow", "rect", "cyl", "line", "poly"),
  corners = 3L, ...)

Arguments

shape

type of shape; choices are 'box', 'arrow', 'line', 'poly', 'circle', and 'cyl'

corners

number of corners to draw if shape = 'poly'

...

additional arguments or graphical parameters passed to the shape functions

See Also

click_text, rect, arrows, rect, rect, segments, polygon, draw.circle, cylindrect

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
op <- par(xpd = NA)
plot.new()
plot.window(0:1, 0:1, asp = 1)
click_shape('line') # a line segment
click_shape('arrow', col = 'blue', code = 2, lwd = 2, length = .15)
click_shape('rect', border = 'purple', col = 'pink', lwd = 2)
click_shape('rect', col = NULL, border = 'purple', lwd = 2)
click_shape('line', col = 'orange', lty = 3, lwd = 3)
click_shape('poly', corners = 5, border = 'green', col = 'orange')
click_shape('poly', corners = 3, border = 'red', col = 'yellow', lty = 1)
click_shape('cyl', col = 'orange')
click_shape('circle', col = 'orange', border = 'black', lty = 3, lwd = 3)
par(op)

## End(Not run)

raredd/plotr documentation built on Nov. 19, 2018, 11:02 a.m.