@@ -888,32 +888,29 @@ def set_tick_params(self, which='major', reset=False, **kw):
888888 For documentation of keyword arguments, see
889889 :meth:`matplotlib.axes.Axes.tick_params`.
890890 """
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 )
896892 kwtrans = self ._translate_tick_kw (kw )
897893
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
905896 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 )
906903 self .reset_ticks ()
907904 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 )
910907 for tick in self .majorTicks :
911908 tick ._apply_params (** kwtrans )
912- if which == 'minor' or which == 'both' :
909+ if which in ['minor' , 'both' ]:
910+ self ._minor_tick_kw .update (kwtrans )
913911 for tick in self .minorTicks :
914912 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
917914 if 'labelcolor' in kwtrans :
918915 self .offsetText .set_color (kwtrans ['labelcolor' ])
919916
0 commit comments