<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/254525</link>
    <title>MATLAB Central Newsreader - Pan and zoom callbacks at once</title>
    <description>Feed for thread: Pan and zoom callbacks at once</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>Wed, 24 Jun 2009 11:08:03 -0400</pubDate>
      <title>Pan and zoom callbacks at once</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/254525#660008</link>
      <author>Norman </author>
      <description>Hi!&lt;br&gt;
&lt;br&gt;
I have a figure with several subplots and I set the YLims, XLims and the Ticks manually. Now, if the user wants to zoom or to pan the plots (linked together via linkaxes), the axis ticks are worthless of course. That's why I wanted to use the ActionPreCallback for the pan and zoom funtion to set the tickLabelMode to 'auto' again. I encountered some weird issue, I think most of them because I never used callback until now, so I want to know what you think of my solution and what might be a better one too.&lt;br&gt;
&lt;br&gt;
In the programm which sets up the subplots these lines are new:&lt;br&gt;
&lt;br&gt;
p = pan(gcf);&lt;br&gt;
set(p,'ActionPreCallback',@myprepancallback);&lt;br&gt;
set(p,'Enable','on');&lt;br&gt;
z = zoom(gcf);&lt;br&gt;
set(z,'ActionPreCallback',@myprezoomcallback);&lt;br&gt;
set(z,'Enable','on');&lt;br&gt;
&lt;br&gt;
In @myprepancallback and @myprezoomcallback the setting of the TickLabelMode is done, something like&lt;br&gt;
&lt;br&gt;
function myprepancallback(obj,evd)&lt;br&gt;
&amp;nbsp;&amp;nbsp;children = get(gcf,'Children') % 1st children is not subplot, so use 2nd		&lt;br&gt;
&amp;nbsp;&amp;nbsp;set(children(2),'XTickMode','auto');&lt;br&gt;
&amp;nbsp;&amp;nbsp;set(children(2),'YTickMode','auto');		&lt;br&gt;
&amp;nbsp;&amp;nbsp;set(children(2),'XTickLabelMode','auto');&lt;br&gt;
&amp;nbsp;&amp;nbsp;set(children(2),'YTickLabelMode','auto');		&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
I noticed that the 'set(p,'Enable','on')' adds on children of gcf, but 'set(z,'Enable','on')' removes that object again, why (and zoom is done, so there seems to be no need for a new children) ? &lt;br&gt;
&lt;br&gt;
Any comments on this?&lt;br&gt;
&lt;br&gt;
Greetings, &lt;br&gt;
Norman</description>
    </item>
  </channel>
</rss>

