[R] locator(n=0)
Prof Brian Ripley
ripley at stats.ox.ac.uk
Fri Feb 27 11:40:16 CET 2004
There is nothing in the design of R base graphics to report the current
position of the mouse without clicking. Indeed, the graphics model does
not presume a mouse and pointer (and probably dates from the days of
cross-hairs manipulated with thumb wheels), and could conceivably use a
touchscreen, for example.
The current graphics driver model is not really extensible either,
although Paul Murrell is working on improving this. We can't add features
to one or two graphical devices without changing the API and all the
devices (not all of which are in the R sources).
On Fri, 27 Feb 2004, Peter Wolf wrote:
> locator(n=1) returns the coordinates of the position of the mouse.
> But you have to click the left button of the mouse.
> How can I determine the mouse position without any click?
> Is it possible to extend locator in a way that
> locator(n=0) outputs the coordinates at once, without any click event?
>
> TclTk allows us to define very nice animations and demonstrations,
> see for example: demo(tkdensity). But sometimes it is much better
> to have output and control in one window and to be able to respond
> to changes of the cursor position (e.g. to that a bandwidth).
But Tcl/Tk is a different sort of system, designed for interactive windows
not plotting graphs. You could do all this in Tcl/Tk (and there is no
reason not to have an R graphics device in a Tcl/Tk canvas), or in a
Java-based graphics device.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list