Set appearance parameters for ticks, ticklabels, and gridlines. For documentation of keyword arguments, see :meth:`matplotlib.axes.Axes.tick_params`. See Also -------- .Axis.get_tick_params View the current style settings for ticks, tick
(self, which='major', reset=False, **kwargs)
| 990 | self.set_minor_locator(mticker.NullLocator()) |
| 991 | |
| 992 | def set_tick_params(self, which='major', reset=False, **kwargs): |
| 993 | """ |
| 994 | Set appearance parameters for ticks, ticklabels, and gridlines. |
| 995 | |
| 996 | For documentation of keyword arguments, see |
| 997 | :meth:`matplotlib.axes.Axes.tick_params`. |
| 998 | |
| 999 | See Also |
| 1000 | -------- |
| 1001 | .Axis.get_tick_params |
| 1002 | View the current style settings for ticks, ticklabels, and |
| 1003 | gridlines. |
| 1004 | """ |
| 1005 | _api.check_in_list(['major', 'minor', 'both'], which=which) |
| 1006 | kwtrans = self._translate_tick_params(kwargs) |
| 1007 | |
| 1008 | # the kwargs are stored in self._major/minor_tick_kw so that any |
| 1009 | # future new ticks will automatically get them |
| 1010 | if reset: |
| 1011 | if which in ['major', 'both']: |
| 1012 | self._reset_major_tick_kw() |
| 1013 | self._major_tick_kw.update(kwtrans) |
| 1014 | if which in ['minor', 'both']: |
| 1015 | self._reset_minor_tick_kw() |
| 1016 | self._minor_tick_kw.update(kwtrans) |
| 1017 | self.reset_ticks() |
| 1018 | else: |
| 1019 | if which in ['major', 'both']: |
| 1020 | self._major_tick_kw.update(kwtrans) |
| 1021 | for tick in self.majorTicks: |
| 1022 | tick._apply_params(**kwtrans) |
| 1023 | if which in ['minor', 'both']: |
| 1024 | self._minor_tick_kw.update(kwtrans) |
| 1025 | for tick in self.minorTicks: |
| 1026 | tick._apply_params(**kwtrans) |
| 1027 | # labelOn and labelcolor also apply to the offset text. |
| 1028 | if 'label1On' in kwtrans or 'label2On' in kwtrans: |
| 1029 | self.offsetText.set_visible( |
| 1030 | self._major_tick_kw.get('label1On', False) |
| 1031 | or self._major_tick_kw.get('label2On', False)) |
| 1032 | if 'labelcolor' in kwtrans: |
| 1033 | self.offsetText.set_color(kwtrans['labelcolor']) |
| 1034 | |
| 1035 | self.stale = True |
| 1036 | |
| 1037 | def get_tick_params(self, which='major'): |
| 1038 | """ |