ptlocator | R Documentation |
Interactively select points on an existing figure and annotated with new plotting characters.
ptlocator(
n = 512L,
x,
y,
col = adjustcolor("red", alpha.f = 0.5),
pch = 16L,
...
)
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 |
Returns (invisibly) the indices of selected points.
http://www.r-bloggers.com/data-point-locator-function/
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.