Clovis, John -
I also made a change in release_zoom for the case that x-axes are
shared and one of the graphs has the aspect_ratio set to ‘equal’ or
‘scaled’. This has been submitted as a patch (John has the file), but I
don’t think it is in CVS yet. It works great. Below is what I added at
the end of the release_zoom function, and the additional function def
fix_aspect_after_zoom(self,a), which I added.
Mark
aspect = a.get_aspect()
if aspect == 'equal' or aspect == 'scaled':
self.fix_aspect_after_zoom(a)
else:
aspect_shared = ''
if a._sharex != None: aspect_shared = a._sharex.get_aspect()
if aspect_shared == 'equal' or aspect_shared == 'scaled':
self.fix_aspect_after_zoom(a._sharex)
self.draw()
self._xypress = None
self._button_pressed == None
self.push_current()
self.release(event)
def fix_aspect_after_zoom(self,a):
lold,bold,wold,hold = a.get_position()
aspect = a.get_aspect()
a.set_aspect(aspect,True)
l,b,w,h = a.get_position()
if w != wold: # width of axes was changed
ratio = w / wold
for
ax in a.get_figure().axes: # see if any subplot shares this axis
if ax._sharex == a:
lax,bax,wax,hax = ax.get_position()
wnew = ratio * wax
lnew = lax
if aspect == ‘equal’: lnew = lax - 0.5 * ( wnew - wax )
ax.set_position( [lnew, bax, wnew, hax] )