Hi Vicent,

I think the following example may help you, althogh their might be a better 
way:

##############################
import matplotlib.pyplot as plt

def callback(ax):
    """ prints mode of toolbar after limits changed

          e.g.
           mode : >zoom rect<
           mode : >pan/zoom<
    """
    print " mode : >%s<" % (plt.get_current_fig_manager().toolbar.mode)

ax = plt.gca()
ax.callbacks.connect('xlim_changed', callback)
ax.callbacks.connect('ylim_changed', callback)
plt.show()
######################################

kind regards Matthias

On Thursday 03 September 2009 14:07:06 Vicent Mas wrote:
> Hi,
>
> I'm a newbie to matplotlib. I'm embedding matplotlib (0,98.5.3) in a
> pyqt application. I'm using the qt4 backend and its navigation
> toolbar.
>
> I wish to execute a certain function every time the view interval of
> a figure is  changed interactively  (i.e. using the zoom rectangle or
> the
> axes pan/zoom button of the navigation toolbar). I'm interested in
> changes due to axes zoom and rectangle zoom but not in changes due
> axes pan. The only way I know for detecting this changes is
> 'x/ylim_changed' events. Unfortunately I don't know how to distinguish
> if the
> event is caused by a rectangle zoom, an axes zoom or an axes pan.
> I've read the events section of the documentation and searched the
> archives for a solution with no luck. Could somebody help me to
> solve this problem?
>
> Thanks in advance.
>
> Vicent
>
> PS:



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to