Skip to content

Commit 6370a6a

Browse files
committed
replace ax.transData in contour.py with proper get_transform call
svn path=/branches/v1_0_maint/; revision=8798
1 parent 582b46f commit 6370a6a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/matplotlib/contour.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,6 @@ def pop_label(self,index=-1):
534534
t.remove()
535535

536536
def labels(self, inline, inline_spacing):
537-
trans = self.ax.transData # A bit of shorthand
538537

539538
if self._use_clabeltext:
540539
add_label = self.add_label_clabeltext
@@ -546,6 +545,7 @@ def labels(self, inline, inline_spacing):
546545
self.labelCValueList ):
547546

548547
con = self.collections[icon]
548+
trans = con.get_transform()
549549
lw = self.get_label_width(lev, self.labelFmt, fsize)
550550
additions = []
551551
paths = con.get_paths()
@@ -1037,13 +1037,14 @@ def find_nearest_contour( self, x, y, indices=None, pixel=True ):
10371037

10381038
for icon in indices:
10391039
con = self.collections[icon]
1040+
trans = con.get_transform()
10401041
paths = con.get_paths()
10411042
for segNum, linepath in enumerate(paths):
10421043
lc = linepath.vertices
10431044

10441045
# transfer all data points to screen coordinates if desired
10451046
if pixel:
1046-
lc = self.ax.transData.transform(lc)
1047+
lc = trans.transform(lc)
10471048

10481049
ds = (lc[:,0]-x)**2 + (lc[:,1]-y)**2
10491050
d = min( ds )

0 commit comments

Comments
 (0)