10000 Remove explicit children invalidation in update_position method · matplotlib/matplotlib@9eea40f · GitHub
[go: up one dir, main page]

Skip to content

Commit 9eea40f

Browse files
committed
Remove explicit children invalidation in update_position method
This invalidation actually does nothing as the `Line2D` does not have nor use the `_invalid` field. There are `_invalidx` and `_invalidy` fields for this purpose, but them are private members. Moreover, the `set_xdata` and `set_ydata` methods internally invalidate the state (what is more reasonable then an external invalidation).
1 parent 9bfad84 commit 9eea40f

File tree

1 file changed

+6
-29
lines changed

1 file changed

+6
-29
lines changed

lib/matplotlib/axis.py

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -446,15 +446,8 @@ def _get_gridline(self):
446446

447447
return l
448448

449-
def update_position(self, loc):
450-
'Set the location of tick in data coords with scalar *loc*'
451-
x = loc
452-
453-
nonlinear = (hasattr(self.axes, 'yaxis') and
454-
self.axes.yaxis.get_scale() != 'linear' or
455-
hasattr(self.axes, 'xaxis') and
456-
self.axes.xaxis.get_scale() != 'linear')
457-
449+
def update_position(self, x):
450+
'Set the location of tick in data coords with scalar *x*'
458451
if self.tick1On:
459452
self.tick1line.set_xdata((x,))
460453
if self.tick2On:
@@ -466,12 +459,7 @@ def update_position(self, loc):
466459
if self.label2On:
467460
self.label2.set_x(x)
468461

469-
if nonlinear:
470-
self.tick1line._invalid = True
471-
self.tick2line._invalid = True
472-
self.gridline._invalid = True
473-
474-
self._loc = loc
462+
self._loc = x
475463
self.stale = True
476464

477465
def get_view_interval(self):
@@ -581,15 +569,8 @@ def _get_gridline(self):
581569
self._set_artist_props(l)
582570
return l
583571

584-
def update_position(self, loc):
585-
'Set the location of tick in data coords with scalar loc'
586-
y = loc
587-
588-
nonlinear = (hasattr(self.axes, 'yaxis') and
589-
self.axes.yaxis.get_scale() != 'linear' or
590-
hasattr(self.axes, 'xaxis') and
591-
self.axes.xaxis.get_scale() != 'linear')
592-
572+
def update_position(self, y):
573+
'Set the location of tick in data coords with scalar *y*'
593574
if self.tick1On:
594575
self.tick1line.set_ydata((y,))
595576
if self.tick2On:
@@ -600,12 +581,8 @@ def update_position(self, loc):
600581
self.label1.set_y(y)
601582
if self.label2On:
602583
self.label2.set_y(y)
603-
if nonlinear:
604-
self.tick1line._invalid = True
605-
self.tick2line._invalid = True
606-
self.gridline._invalid = True
607584

608-
self._loc = loc
585+
self._loc = y
609586
self.stale = True
610587

611588
def get_view_interval(self):

0 commit comments

Comments
 (0)
0