8000 Revert "Refactor handling of tick and ticklabel visiblity in Axis.cle… · matplotlib/matplotlib@df5648d · GitHub
[go: up one dir, main page]

Skip to content

Commit df5648d

Browse files
committed
Revert "Refactor handling of tick and ticklabel visiblity in Axis.clear()"
This reverts commit 2357c92.
1 parent 3b79f63 commit df5648d

File tree

1 file changed

+8
-28
lines changed

1 file changed

+8
-28
lines changed

lib/matplotlib/axis.py

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -846,36 +846,14 @@ def get_children(self):
846846
return [self.label, self.offsetText,
847847
*self.get_major_ticks(), *self.get_minor_ticks()]
848848

849-
def _reset_major_tick_kw(self, keep_tick_and_label_visibility=False):
850-
"""
851-
Reset major tick params to defaults.
852-
853-
Shared subplots pre-configure tick and label visibility. To keep this
854-
beyond an Axis.clear() operation, we may
855-
*keep_tick_and_label_visibility*.
856-
"""
857-
backup = {name: value for name, value in self._major_tick_kw.items()
858-
if name in ['tick1On', 'tick2On', 'label1On', 'label2On']}
849+
def _reset_major_tick_kw(self):
859850
self._major_tick_kw.clear()
860-
if keep_tick_and_label_visibility:
861-
self._major_tick_kw.update(backup)
862851
self._major_tick_kw['gridOn'] = (
863852
mpl.rcParams['axes.grid'] and
864853
mpl.rcParams['axes.grid.which'] in ('both', 'major'))
865854

866-
def _reset_minor_tick_kw(self, keep_tick_and_label_visibility=False):
867-
"""
868-
Reset minor tick params to defaults.
869-
870-
Shared subplots pre-configure tick and label visibility. To keep this
871-
beyond an Axis.clear() operation, we may
872-
*keep_tick_and_label_visibility*.
873-
"""
874-
backup = {name: value for name, value in self._minor_tick_kw.items()
875-
if name in ['tick1On', 'tick2On', 'label1On', 'label2On']}
855+
def _reset_minor_tick_kw(self):
876856
self._minor_tick_kw.clear()
877-
if keep_tick_and_label_visibility:
878-
self._minor_tick_kw.update(backup)
879857
self._minor_tick_kw['gridOn'] = (
880858
mpl.rcParams['axes.grid'] and
881859
mpl.rcParams['axes.grid.which'] in ('both', 'minor'))
@@ -892,8 +870,6 @@ def clear(self):
892870
- major and minor grid
893871
- units
894872
- registered callbacks
895-
896-
This does not reset tick and tick label visibility.
897873
"""
898874
self.label._reset_visual_defaults()
899875
self.offsetText._reset_visual_defaults()
@@ -908,8 +884,12 @@ def clear(self):
908884
signals=["units", "units finalize"])
909885

910886
# whether the grids are on
911-
self._reset_major_tick_kw(keep_tick_and_label_visibility=True)
912-
self._reset_minor_tick_kw(keep_tick_and_label_visibility=True)
887+
self._major_tick_kw['gridOn'] = (
888+
mpl.rcParams['axes.grid'] and
889+
mpl.rcParams['axes.grid.which'] in ('both', 'major'))
890+
self._minor_tick_kw['gridOn'] = (
891+
mpl.rcParams['axes.grid'] and
892+
mpl.rcParams['axes.grid.which'] in ('both', 'minor'))
913893
self.reset_ticks()
914894

915895
self.converter = None

0 commit comments

Comments
 (0)
0