Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Getting pointer position within axes
Date: Tue, 26 Feb 2008 21:13:02 +0000 (UTC)
Organization: EGI University of Utah
Lines: 58
Message-ID: <fq1vcu$f80$1@fred.mathworks.com>
References: <fq1jal$jg7$1@fred.mathworks.com> <fq1tvu$mr3$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1204060382 15616 172.30.248.37 (26 Feb 2008 21:13:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 26 Feb 2008 21:13:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1123144
Xref: news.mathworks.com comp.soft-sys.matlab:453875



Thanks, Ilya.  

I now see that I don't have to actually click with my mouse
to trigger the WindowButtonMotionFcn.  A big problem still
remains, though.  Now that I've got the cursor position, in
figure coordinates, how do I determine (programmatically)
what object my cursor is currently near?  The objects are
points that I plotted in a graph axes using the plot
command.  I have no way of telling what each point's
position is, in terms of figure units.  (Or can I?)  I only
know each point's position in my data units (for example age
vs. feet).

- Michelle

"Ilya Rozenfeld" <rozeni.nospam@alum.rpi.edu> wrote in
message <fq1tvu$mr3$1@fred.mathworks.com>...
> Check help for "WindowButtonMotionFcn" and "CurrentPoint".
> 
> In the callback for WindowButtonMotionFcn you can query 
> cursor position (in the figure coordinates) using 
> CurrentPoint property and if it is close enough to your 
> object then trigger some event.
> 
> 
> "Michelle " <mkline@egi.utah.edu> wrote in message 
> <fq1jal$jg7$1@fred.mathworks.com>...
> > Hello,
> > 
> > Here is what I would like to do:
> > 
> > When my mouse rolls over a plot object in an axes, I 
> want to
> > plot some text that identifies the object, directly next 
> to
> > the object.  I don't want to have to click on the object 
> to
> > make this text display in the axes.  I just want to roll
> > over the object.  
> > 
> > I have the Image Processing Toolbox installed, and have
> > tried working with iptPointerManager to accomplish the
> > desired task.  However, the iptPointerManager seems to
> > maintain only the pointer's current position in the 
> figure,
> > and in pixels.  I don't know how to translate the pointer
> > position (in pixels, with respect to the figure) to the
> > location of the plotted object (in data units, with 
> respect
> > to the axes).
> > 
> > Can anyone suggest a solution?
> > 
> > Thank you,
> > 
> > Michelle Kline
>