[R] locator(n=0)

Dirk Eddelbuettel edd at debian.org
Fri Feb 27 17:00:17 CET 2004


Peter,

On Fri, Feb 27, 2004 at 10:16:54AM +0100, 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).

James Wettenhall has an example of how to do that using tcltk. The window
manager gives us back x,y pixel coordinates, which can be converted back to
plot coordinates using par("usr") and par("plt") -- it's pretty much all
there on James' example page at
  http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/InteractiveTkrPlot.html
  
Hth, Dirk

-- 
The relationship between the computed price and reality is as yet unknown.  
                                             -- From the pac(8) manual page




More information about the R-help mailing list