Re(2): [R] Interacting with graphics: image

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Aug 1 15:44:26 CEST 2001


On Wed, 1 Aug 2001, Agustin Lobo wrote:

[...]

> I had tried something similar, but this is non-interactive.
> locator() collects n points and then outputs the result as a list. What
> I'm
> trying to do is to browse the image values on the screen, for which
> I would need locator() to output the x,y coordinate after each
> click with the mouse. If I use locator(n=1) I get the x,y coordinate,
> but then the function ends. I think that an option to output one
> coordinate at each click would be good in the future.

Impossible.  R is single-threaded, and so locator() has to end before
anything returned is accessible to any other code. You need to use a loop
(as you did).

[...]

-- 
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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list