|
From: Ryan M. <rm...@gm...> - 2009-02-13 15:57:03
|
On Fri, Feb 13, 2009 at 6:24 AM, John Hunter <jd...@gm...> wrote: > On Thu, Feb 12, 2009 at 2:13 PM, Ryan May <rm...@gm...> wrote: > > On Wed, Feb 11, 2009 at 7:30 PM, John Hunter <jd...@gm...> wrote: > >> > >> On Wed, Feb 11, 2009 at 2:49 PM, Ryan May <rm...@gm...> wrote: > > > Well, I checked in an example that shows the functionality. The problem > is > > 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 > the > > callback, but rather the originating axes instance. Are these events > relics > > 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 > it. > 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 event handler: 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. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma |