From: Michael D. <md...@st...> - 2008-06-16 12:54:46
|
Eric Firing wrote: > Mike, > > John's mention of an upcoming bugfix release brought to mind a glitch > in 0.98: the default position of the polar plot title is too low (as > is the default position of the title on an ordinary plot with > tick_top()). > > It looks like you were working on this with your autoLayout option, > but when I try enabling that, I get (last part of traceback only, and > for the Cartesian axes case): > > /usr/local/lib/python2.5/site-packages/matplotlib/axes.pyc in > update_layout(self, renderer) > 1421 x0, y0, x1, y1 = self.get_position(True).extents > 1422 # Adjust the title > -> 1423 self.titleOffsetTrans.clear().translate( > 1424 0, original_t_text + pad_pixels * 2.0) > 1425 > > AttributeError: 'ScaledTranslation' object has no attribute 'clear' > > > It looks like this would be prevented if ScaledTranslation were > reformulated to inherit from Affine2D instead of Affine2DBase. > > Is this the right solution? No -- Affine2D is for mutable transformations, and a ScaledTransformation is automatic (it really doesn't make sense to clear it). The real bug here is that the auto layout code has grown stale. It should probably remove it, since it was basically an aborted experiment and I don't want to create confusion. It turned out to be too difficult (perhaps impossible) to do the right thing in the general case given the current MATLAB-based APIs for laying out a figure. The real solution will need to provide a new API (which would be an alternative to the current one) that works somewhat like the box layout APIs in many GUI toolkits. Once I got to that point, I realised that would take more time beyond what I had allotted. > > Regardless of the status of the autoLayout code, I thought it would be > nice to improve the default title behavior of the polar_demo, at least. I've changed it so it behaves identically to 0.91.x, which is not great (since it puts the title too close to the edge of the figure), but at least it isn't a regression. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA |