Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2f6ee5e

Browse files
committed
Fix bug in zoom rectangle with twin axes
svn path=/branches/v0_91_maint/; revision=6365
1 parent 72c10b4 commit 2f6ee5e

2 files changed

Lines changed: 15 additions & 11 deletions

File tree

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2008-11-05 Fix bug with zoom to rectangle and twin axes - MGD
2+
13
2008-10-05 Fix problem with AFM files that don't specify the font's
24
full name or family name. - JKS
35

lib/matplotlib/backend_bases.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ def sort_artists(artists):
903903
# can't delete the artist
904904
while h:
905905
print "Removing",h
906-
if h.remove():
906+
if h.remove():
907907
self.draw_idle()
908908
break
909909
parent = None
@@ -912,7 +912,7 @@ def sort_artists(artists):
912912
parent = p
913913
break
914914
h = parent
915-
915+
916916
def onHilite(self, ev):
917917
"""
918918
Mouse event processor which highlights the artists
@@ -1087,7 +1087,7 @@ def get_width_height(self):
10871087
# a) otherwise we'd have cyclical imports, since all of these
10881088
# classes inherit from FigureCanvasBase
10891089
# b) so we don't import a bunch of stuff the user may never use
1090-
1090+
10911091
def print_emf(self, *args, **kwargs):
10921092
from backends.backend_emf import FigureCanvasEMF # lazy import
10931093
emf = self.switch_backends(FigureCanvasEMF)
@@ -1097,7 +1097,7 @@ def print_eps(self, *args, **kwargs):
10971097
from backends.backend_ps import FigureCanvasPS # lazy import
10981098
ps = self.switch_backends(FigureCanvasPS)
10991099
return ps.print_eps(*args, **kwargs)
1100-
1100+
11011101
def print_pdf(self, *args, **kwargs):
11021102
from backends.backend_pdf import FigureCanvasPdf # lazy import
11031103
pdf = self.switch_backends(FigureCanvasPdf)
@@ -1107,7 +1107,7 @@ def print_png(self, *args, **kwargs):
11071107
from backends.backend_agg import FigureCanvasAgg # lazy import
11081108
agg = self.switch_backends(FigureCanvasAgg)
11091109
return agg.print_png(*args, **kwargs)
1110-
1110+
11111111
def print_ps(self, *args, **kwargs):
11121112
from backends.backend_ps import FigureCanvasPS # lazy import
11131113
ps = self.switch_backends(FigureCanvasPS)
@@ -1123,12 +1123,12 @@ def print_svg(self, *args, **kwargs):
11231123
from backends.backend_svg import FigureCanvasSVG # lazy import
11241124
svg = self.switch_backends(FigureCanvasSVG)
11251125
return svg.print_svg(*args, **kwargs)
1126-
1126+
11271127
def print_svgz(self, *args, **kwargs):
11281128
from backends.backend_svg import FigureCanvasSVG # lazy import
11291129
svg = self.switch_backends(FigureCanvasSVG)
11301130
return svg.print_svgz(*args, **kwargs)
1131-
1131+
11321132
def get_supported_filetypes(self):
11331133
return self.filetypes
11341134

@@ -1138,7 +1138,7 @@ def get_supported_filetypes_grouped(self):
11381138
groupings.setdefault(name, []).append(ext)
11391139
groupings[name].sort()
11401140
return groupings
1141-
1141+
11421142
def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w',
11431143
orientation='portrait', format=None, **kwargs):
11441144
"""
@@ -1176,7 +1176,7 @@ def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w',
11761176

11771177
if dpi is None:
11781178
dpi = rcParams['savefig.dpi']
1179-
1179+
11801180
origDPI = self.figure.dpi.get()
11811181
origfacecolor = self.figure.get_facecolor()
11821182
origedgecolor = self.figure.get_edgecolor()
@@ -1199,12 +1199,12 @@ def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w',
11991199
self.figure.set_edgecolor(origedgecolor)
12001200
self.figure.set_canvas(self)
12011201
self.figure.canvas.draw()
1202-
1202+
12031203
return result
12041204

12051205
def get_default_filetype(self):
12061206
raise NotImplementedError
1207-
1207+
12081208
def set_window_title(self, title):
12091209
"""
12101210
Set the title text of the window containing the figure. Note that
@@ -1696,6 +1696,8 @@ def release_zoom(self, event):
16961696
for cur_xypress in self._xypress:
16971697
x, y = event.x, event.y
16981698
lastx, lasty, a, ind, lim, trans = cur_xypress
1699+
if a._sharex or a._sharey:
1700+
continue
16991701
# ignore singular clicks - 5 pixels is a threshold
17001702
if abs(x-lastx)<5 or abs(y-lasty)<5:
17011703
self._xypress = None

0 commit comments

Comments
 (0)