ptlocator: Point locator

Description Usage Arguments Value References Examples

View source: R/plot_extra.R

Description

Interactively select points on an existing figure and annotated with new plotting characters.

Usage

1
2
ptlocator(n = 512L, x, y, col = adjustcolor("red", alpha.f = 0.5),
  pch = 16L, ...)

Arguments

n

the maximum number of points to locate

x, y

x- and y-coordinates

col

color for points

pch

plotting character

...

additional graphical arguments passed to points

Value

Returns (invisibly) the indices of selected points.

References

http://www.r-bloggers.com/data-point-locator-function/

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
set.seed(1)
n <- 200
x <- sort(runif(n, 0, 10 * pi))
y <- sin(x) + rnorm(n, 0, .2)

plot(x, y, cex = 2)
p <- ptlocator(10, x, y, cex = 2)
cbind(x = x[p], y = y[p])

## End(Not run)

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