Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9473f24

Browse files
Backport PR#23834: Revert "Refactor handling of tick and ticklabel visiblity in Axis.clear" (#23838)
Co-authored-by: Jody Klymak <jklymak@gmail.com>
1 parent78fe285 commit9473f24

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:valueforname,valueinself._major_tick_kw.items()
858-
ifnamein ['tick1On','tick2On','label1On','label2On']}
849+
def_reset_major_tick_kw(self):
859850
self._major_tick_kw.clear()
860-
ifkeep_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:valueforname,valueinself._minor_tick_kw.items()
875-
ifnamein ['tick1On','tick2On','label1On','label2On']}
855+
def_reset_minor_tick_kw(self):
876856
self._minor_tick_kw.clear()
877-
ifkeep_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

899875
self.label.set_text('')# self.set_label_text would change isDefault_
@@ -905,8 +881,12 @@ def clear(self):
905881
signals=["units","units finalize"])
906882

907883
# whether the grids are on
908-
self._reset_major_tick_kw(keep_tick_and_label_visibility=True)
909-
self._reset_minor_tick_kw(keep_tick_and_label_visibility=True)
884+
self._major_tick_kw['gridOn']= (
885+
mpl.rcParams['axes.grid']and
886+
mpl.rcParams['axes.grid.which']in ('both','major'))
887+
self._minor_tick_kw['gridOn']= (
888+
mpl.rcParams['axes.grid']and
889+
mpl.rcParams['axes.grid.which']in ('both','minor'))
910890
self.reset_ticks()
911891

912892
self.converter=None

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp