Reads the position of the graphics cursor when the (first) mouse button is pressed.
locator(n = 512, type = "n", ...)
the maximum number of points to locate. Valid values start at 1.
additional graphics parameters used if
locator is only supported on screen devices such as
quartz. On other devices the
call will do nothing.
Unless the process is terminated prematurely by the user (see below)
n positions are determined.
For the usual
X11 device the identification process is
terminated by pressing any mouse button other than the first.
quartz device the process is terminated by
The current graphics parameters apply just as if
has been called with the same value of
type. The plotting of
the points and lines is subject to clipping, but locations outside the
current clipping rectangle will be returned.
On most devices which support
locator, successful selection of
a point is indicated by a bell sound unless
options(locatorBell = FALSE) has been set.
If the window is resized or hidden and then exposed before the input
process has terminated, any lines or points drawn by
will disappear. These will reappear once the input process has
terminated and the window is resized or hidden and exposed again.
This is because the points and lines drawn by
locator are not
recorded in the device's display list until the input process has
A list containing
y components which are the
coordinates of the identified points in the user coordinate system,
i.e., the one specified by
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
grid.locator is the corresponding grid
dev.capabilities to see if it is supported.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.