[R] interactive 2-D plot interrogation
Dirk Eddelbuettel
edd at debian.org
Sun Feb 1 20:23:13 CET 2004
On Sun, Feb 01, 2004 at 01:53:14PM -0500, Charles Annis, P.E. wrote:
> Greetings Friends:
>
> I am trying to find a widget or some other method to let me interrogate a
> 2-D image using the mouse. I have a data.frame that I can visualize using
> image() in R. I would like to point to a pixel and have its coordinates
> displayed.
>
> I've read Peter Dalgaard's primer on R-Tcl/Tk, R-News, 1(3):27-31, and his
> update R-News2(3):25-27, but am still struggling.
>
> Can anyone suggest a method for interactively interrogating of a 2-D image?
Look at the InteractiveTkrPlot example on James Wettenhall's site:
http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/InteractiveTkrPlot.html
His example is over discrete set of points, which you can adapt to find the
location with respect to curves or lines (which I did at work, where I can't
get to right now).
The key is that the 'widget' you bind to an event (like left-Mouse in his
example) get (x,y) pixel coordinates from the system which given appropriate
information from par() can be translated into your data coordinates in just
a few steps.
James' site is a treasure chest for R and tcltk. Highly recommended.
Hope this helps, 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