Skip to content

interactive 2-D plot interrogation

3 messages · Charles Annis, P.E., Dirk Eddelbuettel, Paul Murrell

#
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?

Many thanks.

Charles Annis, P.E.
 
Charles.Annis at StatisticalEngineering.com
phone: 561-352-9699
eFax:  503-217-4849
http://www.StatisticalEngineering.com
#
On Sun, Feb 01, 2004 at 01:53:14PM -0500, Charles Annis, P.E. wrote:
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
#
Hi

Depending on how you want the coordinates displayed, the locator() 
function may help you, or perhaps a simple function written around 
locator() to process its result into something more meaningful for your 
siutation.

Paul
Dirk Eddelbuettel wrote: