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

Skip to content

Commit 605aebb

Browse files
committed
Fix bug in Line2D from last commit: restore full recache in unit chane callback
svn path=/trunk/matplotlib/; revision=8055
1 parent 0179326 commit 605aebb

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

lib/matplotlib/lines.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,9 @@ def get_window_extent(self, renderer):
388388
def set_axes(self, ax):
389389
Artist.set_axes(self, ax)
390390
if ax.xaxis is not None:
391-
self._xcid = ax.xaxis.callbacks.connect('units', self.recache)
391+
self._xcid = ax.xaxis.callbacks.connect('units', self.recache_always)
392392
if ax.yaxis is not None:
393-
self._ycid = ax.yaxis.callbacks.connect('units', self.recache)
393+
self._ycid = ax.yaxis.callbacks.connect('units', self.recache_always)
394394
set_axes.__doc__ = Artist.set_axes.__doc__
395395

396396
def set_data(self, *args):
@@ -407,8 +407,11 @@ def set_data(self, *args):
407407
self.set_xdata(x)
408408
self.set_ydata(y)
409409

410-
def recache(self):
411-
if self._invalidx:
410+
def recache_always(self):
411+
self.recache(always=True)
412+
413+
def recache(self, always=False):
414+
if always or self._invalidx:
412415
xconv = self.convert_xunits(self._xorig)
413416
if ma.isMaskedArray(self._xorig):
414417
x = ma.asarray(xconv, float)
@@ -417,7 +420,7 @@ def recache(self):
417420
x = x.ravel()
418421
else:
419422
x = self._x
420-
if self._invalidy:
423+
if always or self._invalidy:
421424
yconv = self.convert_yunits(self._yorig)
422425
if ma.isMaskedArray(self._yorig):
423426
y = ma.asarray(yconv, float)

0 commit comments

Comments
 (0)