@@ -888,32 +888,29 @@ def set_tick_params(self, which='major', reset=False, **kw):
888
888
For documentation of keyword arguments, see
889
889
:meth:`matplotlib.axes.Axes.tick_params`.
890
890
"""
891
- dicts = []
892
- if which == 'major' or which == 'both' :
893
- dicts .append (self ._major_tick_kw )
894
- if which == 'minor' or which == 'both' :
895
- dicts .append (self ._minor_tick_kw )
891
+ cbook ._check_in_list (['major' , 'minor' , 'both' ], which = which )
896
892
kwtrans = self ._translate_tick_kw (kw )
897
893
898
- # this stashes the parameter changes so any new ticks will
899
- # automatically get them
900
- for d in dicts :
901
- if reset :
902
- d .clear ()
903
- d .update (kwtrans )
904
-
894
+ # the kwargs are stored in self._major/minor_tick_kw so that any
895
+ # future new ticks will automatically get them
905
896
if reset :
897
+ if which in ['major' , 'both' ]:
898
+ self ._major_tick_kw .clear ()
899
+ self ._major_tick_kw .update (kwtrans )
900
+ if which in ['minor' , 'both' ]:
901
+ self ._minor_tick_kw .clear ()
902
+ self ._minor_tick_kw .update (kwtrans )
906
903
self .reset_ticks ()
907
904
else :
908
- # apply the new kwargs to the existing ticks
909
- if which == 'major' or which == 'both' :
905
+ if which in [ 'major' , 'both' ]:
906
+ self . _major_tick_kw . update ( kwtrans )
910
907
for tick in self .majorTicks :
911
908
tick ._apply_params (** kwtrans )
912
- if which == 'minor' or which == 'both' :
909
+ if which in ['minor' , 'both' ]:
910
+ self ._minor_tick_kw .update (kwtrans )
913
911
for tick in self .minorTicks :
914
912
tick ._apply_params (** kwtrans )
915
- # special-case label color to also apply to the offset
916
- # text
913
+ # special-case label color to also apply to the offset text
917
914
if 'labelcolor' in kwtrans :
918
915
self .offsetText .set_color (kwtrans ['labelcolor' ])
919
916
0 commit comments