locator(n=500, type="n")
type
is
"n"
, nothing is drawn.
Values of
"p"
,
"l"
,
"b"
, and
"o"
plot points at the digitized
coordinates, lines connecting them, both points
and lines, or overplotted points and lines.
x
and
y
, which
give coordinates for each point.
The length of these vectors is at most
n
,
but can be shorter if the user terminates
graphic input after fewer than
n
points are given.
If the user terminates the graphic input before selecting any vector, the function
returns
numeric(0)
, rather than
list(x=numeric(0),y=numeric(0))
.
type
does not equal
"n"
, then points and/or lines are added to the
current plot.
When using the
motif
driver under
the X Window System,
a point is identified by positioning the cursor over the point
and pressing the left mouse button.
To exit
locator
,
press the middle button
(both buttons on a two button mouse)
while the cursor is in the graphics window.
This function may also be used with the "tek14" drivers.
Some devices that don't allow real interaction will prompt you for an x,y
pair.
We do not recommend the use of
locator
or
identify
to pause between pages when showing a series of graphs. Instead use
ask=T
in the plotting commands.
Remember that you must locate
n
points
or exit
locator
in order
to be able to get back to the S-PLUS prompt.
# user points at an outlier which is then labelled plot(1:10, rt(10, 1)) # some cauchy data text(locator(1), "outlier") # position a legend legend(locator(1), legend=c("IBM", "AT&T", "GM"), fill=2:4) lines(locator()) # input a number of points, connect with line locator(type="l") # alternative