<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164607</link>
    <title>MATLAB Central Newsreader - Getting pointer position within axes</title>
    <description>Feed for thread: Getting pointer position within axes</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 26 Feb 2008 17:47:01 -0500</pubDate>
      <title>Getting pointer position within axes</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164607#417472</link>
      <author>Michelle </author>
      <description>Hello,&lt;br&gt;
&lt;br&gt;
Here is what I would like to do:&lt;br&gt;
&lt;br&gt;
When my mouse rolls over a plot object in an axes, I want to&lt;br&gt;
plot some text that identifies the object, directly next to&lt;br&gt;
the object.  I don't want to have to click on the object to&lt;br&gt;
make this text display in the axes.  I just want to roll&lt;br&gt;
over the object.  &lt;br&gt;
&lt;br&gt;
I have the Image Processing Toolbox installed, and have&lt;br&gt;
tried working with iptPointerManager to accomplish the&lt;br&gt;
desired task.  However, the iptPointerManager seems to&lt;br&gt;
maintain only the pointer's current position in the figure,&lt;br&gt;
and in pixels.  I don't know how to translate the pointer&lt;br&gt;
position (in pixels, with respect to the figure) to the&lt;br&gt;
location of the plotted object (in data units, with respect&lt;br&gt;
to the axes).&lt;br&gt;
&lt;br&gt;
Can anyone suggest a solution?&lt;br&gt;
&lt;br&gt;
Thank you,&lt;br&gt;
&lt;br&gt;
Michelle Kline</description>
    </item>
    <item>
      <pubDate>Tue, 26 Feb 2008 20:49:02 -0500</pubDate>
      <title>Re: Getting pointer position within axes</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164607#417530</link>
      <author>Ilya Rozenfeld</author>
      <description>Check help for &quot;WindowButtonMotionFcn&quot; and &quot;CurrentPoint&quot;.&lt;br&gt;
&lt;br&gt;
In the callback for WindowButtonMotionFcn you can query &lt;br&gt;
cursor position (in the figure coordinates) using &lt;br&gt;
CurrentPoint property and if it is close enough to your &lt;br&gt;
object then trigger some event.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&quot;Michelle &quot; &amp;lt;mkline@egi.utah.edu&amp;gt; wrote in message &lt;br&gt;
&amp;lt;fq1jal$jg7$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hello,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Here is what I would like to do:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; When my mouse rolls over a plot object in an axes, I &lt;br&gt;
want to&lt;br&gt;
&amp;gt; plot some text that identifies the object, directly next &lt;br&gt;
to&lt;br&gt;
&amp;gt; the object.  I don't want to have to click on the object &lt;br&gt;
to&lt;br&gt;
&amp;gt; make this text display in the axes.  I just want to roll&lt;br&gt;
&amp;gt; over the object.  &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I have the Image Processing Toolbox installed, and have&lt;br&gt;
&amp;gt; tried working with iptPointerManager to accomplish the&lt;br&gt;
&amp;gt; desired task.  However, the iptPointerManager seems to&lt;br&gt;
&amp;gt; maintain only the pointer's current position in the &lt;br&gt;
figure,&lt;br&gt;
&amp;gt; and in pixels.  I don't know how to translate the pointer&lt;br&gt;
&amp;gt; position (in pixels, with respect to the figure) to the&lt;br&gt;
&amp;gt; location of the plotted object (in data units, with &lt;br&gt;
respect&lt;br&gt;
&amp;gt; to the axes).&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Can anyone suggest a solution?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thank you,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Michelle Kline</description>
    </item>
    <item>
      <pubDate>Tue, 26 Feb 2008 21:13:02 -0500</pubDate>
      <title>Re: Getting pointer position within axes</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164607#417540</link>
      <author>Michelle </author>
      <description>Thanks, Ilya.  &lt;br&gt;
&lt;br&gt;
I now see that I don't have to actually click with my mouse&lt;br&gt;
to trigger the WindowButtonMotionFcn.  A big problem still&lt;br&gt;
remains, though.  Now that I've got the cursor position, in&lt;br&gt;
figure coordinates, how do I determine (programmatically)&lt;br&gt;
what object my cursor is currently near?  The objects are&lt;br&gt;
points that I plotted in a graph axes using the plot&lt;br&gt;
command.  I have no way of telling what each point's&lt;br&gt;
position is, in terms of figure units.  (Or can I?)  I only&lt;br&gt;
know each point's position in my data units (for example age&lt;br&gt;
vs. feet).&lt;br&gt;
&lt;br&gt;
- Michelle&lt;br&gt;
&lt;br&gt;
&quot;Ilya Rozenfeld&quot; &amp;lt;rozeni.nospam@alum.rpi.edu&amp;gt; wrote in&lt;br&gt;
message &amp;lt;fq1tvu$mr3$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Check help for &quot;WindowButtonMotionFcn&quot; and &quot;CurrentPoint&quot;.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; In the callback for WindowButtonMotionFcn you can query &lt;br&gt;
&amp;gt; cursor position (in the figure coordinates) using &lt;br&gt;
&amp;gt; CurrentPoint property and if it is close enough to your &lt;br&gt;
&amp;gt; object then trigger some event.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &quot;Michelle &quot; &amp;lt;mkline@egi.utah.edu&amp;gt; wrote in message &lt;br&gt;
&amp;gt; &amp;lt;fq1jal$jg7$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Hello,&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Here is what I would like to do:&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; When my mouse rolls over a plot object in an axes, I &lt;br&gt;
&amp;gt; want to&lt;br&gt;
&amp;gt; &amp;gt; plot some text that identifies the object, directly next &lt;br&gt;
&amp;gt; to&lt;br&gt;
&amp;gt; &amp;gt; the object.  I don't want to have to click on the object &lt;br&gt;
&amp;gt; to&lt;br&gt;
&amp;gt; &amp;gt; make this text display in the axes.  I just want to roll&lt;br&gt;
&amp;gt; &amp;gt; over the object.  &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; I have the Image Processing Toolbox installed, and have&lt;br&gt;
&amp;gt; &amp;gt; tried working with iptPointerManager to accomplish the&lt;br&gt;
&amp;gt; &amp;gt; desired task.  However, the iptPointerManager seems to&lt;br&gt;
&amp;gt; &amp;gt; maintain only the pointer's current position in the &lt;br&gt;
&amp;gt; figure,&lt;br&gt;
&amp;gt; &amp;gt; and in pixels.  I don't know how to translate the pointer&lt;br&gt;
&amp;gt; &amp;gt; position (in pixels, with respect to the figure) to the&lt;br&gt;
&amp;gt; &amp;gt; location of the plotted object (in data units, with &lt;br&gt;
&amp;gt; respect&lt;br&gt;
&amp;gt; &amp;gt; to the axes).&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Can anyone suggest a solution?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thank you,&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Michelle Kline&lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Sun, 16 Mar 2008 21:49:03 -0400</pubDate>
      <title>Re: Getting pointer position within axes</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164607#421194</link>
      <author>sourabh bora</author>
      <description>Hi Michelle,&lt;br&gt;
I am facing the same problem as you.. how to determine the&lt;br&gt;
location of objects within the axes. I would be glad if you&lt;br&gt;
let me know once you find the solution.&lt;br&gt;
&amp;nbsp;A matlab program called freehanddraw.m can give you some&lt;br&gt;
idea how to work with window mouse button.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;another approach you may try is using ginput. &lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=7347&amp;objectType=File&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=7347&amp;objectType=File&lt;/a&gt;&lt;br&gt;
Thanks&lt;br&gt;
Sourabh Bpra&lt;br&gt;
&lt;br&gt;
&quot;Michelle &quot; &amp;lt;mkline@egi.utah.edu&amp;gt; wrote in message&lt;br&gt;
&amp;lt;fq1vcu$f80$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Thanks, Ilya.  &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I now see that I don't have to actually click with my mouse&lt;br&gt;
&amp;gt; to trigger the WindowButtonMotionFcn.  A big problem still&lt;br&gt;
&amp;gt; remains, though.  Now that I've got the cursor position, in&lt;br&gt;
&amp;gt; figure coordinates, how do I determine (programmatically)&lt;br&gt;
&amp;gt; what object my cursor is currently near?  The objects are&lt;br&gt;
&amp;gt; points that I plotted in a graph axes using the plot&lt;br&gt;
&amp;gt; command.  I have no way of telling what each point's&lt;br&gt;
&amp;gt; position is, in terms of figure units.  (Or can I?)  I only&lt;br&gt;
&amp;gt; know each point's position in my data units (for example age&lt;br&gt;
&amp;gt; vs. feet).&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; - Michelle&lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Thu, 04 Jun 2009 14:24:01 -0400</pubDate>
      <title>Re: Getting pointer position within axes</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164607#654675</link>
      <author>Rikki </author>
      <description>Look at this link: &lt;a href=&quot;http://msenux.redwoods.edu/Math4Textbook/Programming/NestedFunctions.pdf&quot;&gt;http://msenux.redwoods.edu/Math4Textbook/Programming/NestedFunctions.pdf&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
#7 at the end shows you exactly how to do this.</description>
    </item>
  </channel>
</rss>

