On Fri, Feb 13, 2009 at 6:24 AM, John Hunter <jdh2358@...> wrote:
> On Thu, Feb 12, 2009 at 2:13 PM, Ryan May <rmay31@...> wrote:
> > On Wed, Feb 11, 2009 at 7:30 PM, John Hunter <jdh2358@...> wrote:
> >> On Wed, Feb 11, 2009 at 2:49 PM, Ryan May <rmay31@...> wrote:
> > Well, I checked in an example that shows the functionality. The problem
> > that using these events doesn't follow the standard event API. You don't
> > connect using figure.canvas.mpl_connect() (it doesn't like the names
> > 'xlim_changed' and 'ylim_changed'), but rather you use
> > Axes.callbacks.connect(). Also, the an event object is not passed into
> > callback, but rather the originating axes instance. Are these events
> > to the older version of event handling that haven't been moved to the
> > present?
> > Otherwise, should I add a special section to the event handling docs to
> > handle these?
> Thanks for the example -- you are right that this is a 'legacy' event
> callback outside the regular event framework. So it doesn't really
> belong in the event handling chapter but may merit a quick note there.
> Alternatively, we could rather easily draft up a special event
> (NavigationEvent?) that *does* work in the regular event handling
> framework. The quirk is that the events are handled at the canvas
> level, so it would be difficult to register for a single axes, but one
> could get a NavigationEvent if the limits of any of the axes in the
> figure were updated, and use the inaxes attribute to process it. If
> this, or some variant of it, seems like a good idea I'm happy to add
I'm +1 on your idea. While it may be a little quirky that you can't
register for a single axes limit change, it's even weirder that you have
different ways to register for different types of events. I think the
overall API for matplotlib is improved by bringing *all* event callbacks
under a single, unified, API. Along those lines, I see these other 'events'
being processed in the code, but not formally recognized by the canvas level
Aixs : 'units', 'units finalize'
Figure : 'dpi_changed'
Would it be good to try to move these to the canvas-level handler as well? I
don't have a good idea myself of how that would work right now.
Graduate Research Assistant
School of Meteorology
University of Oklahoma