On 9/12/07, Michael Droettboom <[EMAIL PROTECTED]> wrote: > This approach got closer, until I hit the wall that dependencies work at > an even lower level -- single lazy values get borrowed from one bounding > box and referenced in another (e.g. Axes.autoscale_view()) Certainly, > this could be implemented in my new affine-based framework, but then > we're almost back to square one and have basically re-implemented > transforms.py/.cpp into something that is probably slower -- though > perhaps more flexible in that more kinds of transforms could be added > using only Python. Of course, autoscale_view() (and other instances of > this) could be rewritten to work differently, but it's hard to know > where that might end.
The locators do have a reference to the datalim and viewlim intervals, which is is what they use to compute their autoscale limits and tick locations, but they return scalars, and autoscale_view simply sets the new limits with these scalars. So the fact that there is a reference here is easy to work around. I made a minor change in your code (ticker.py and axis.py) to illustrate. Instead of relying on the Interval to pass information from the Axis -> Locator/Formatter, I simply set the axis instance instead. Then, eg, the Locator can do vmin, vmax = self.axis.get_view_interval() dmin, dmax = self.axis.get_data_interval() so there are no confusing intertwined references to deal with, and the axis can be responsible for knowings its data and view limits, which seem reasonable. I made these changes just to the MaxNLocator and ScalarFormatter classes for proof of concept, but it should be trivial to port to the others. I think in general communicating by scalar values passed explicitly or through callbacks will make for clearer code than the deeply nested references we have been using the in the existingcode. There are places where one bounding box value is shared with another (most clearly in sharex and sharey support, eg left = self._sharex.viewLim.xmin() The ability to "share" and axis, eg so changes in pan and zoom on one are reflected in another, is extremely useful, but a better approach may be to use callbacks (or something like them) rather than shared, composited transforms which are updated in place. I need to spend more time reading through your code before I comment further, but I just wanted to make a quick comment vis-a-vis the locators and formatters. I commited these changes to your branch, and autoscaling is now working there :-) I'll keep poking and learning more about what you are doing before commenting on some of your bigger questions. I made a couple of comments in affine.py as well, prefixed by 'JDH' JDH ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel