Get appearance parameters for ticks, ticklabels, and gridlines. .. versionadded:: 3.7 Parameters ---------- which : {'major', 'minor'}, default: 'major' The group of ticks for which the parameters are retrieved. Returns -------
(self, which='major')
| 1035 | self.stale = True |
| 1036 | |
| 1037 | def get_tick_params(self, which='major'): |
| 1038 | """ |
| 1039 | Get appearance parameters for ticks, ticklabels, and gridlines. |
| 1040 | |
| 1041 | .. versionadded:: 3.7 |
| 1042 | |
| 1043 | Parameters |
| 1044 | ---------- |
| 1045 | which : {'major', 'minor'}, default: 'major' |
| 1046 | The group of ticks for which the parameters are retrieved. |
| 1047 | |
| 1048 | Returns |
| 1049 | ------- |
| 1050 | dict |
| 1051 | Properties for styling tick elements added to the axis. |
| 1052 | |
| 1053 | Notes |
| 1054 | ----- |
| 1055 | This method returns the appearance parameters for styling *new* |
| 1056 | elements added to this axis and may be different from the values |
| 1057 | on current elements if they were modified directly by the user |
| 1058 | (e.g., via ``set_*`` methods on individual tick objects). |
| 1059 | |
| 1060 | Examples |
| 1061 | -------- |
| 1062 | :: |
| 1063 | |
| 1064 | >>> ax.yaxis.set_tick_params(labelsize=30, labelcolor='red', |
| 1065 | ... direction='out', which='major') |
| 1066 | >>> ax.yaxis.get_tick_params(which='major') |
| 1067 | {'direction': 'out', |
| 1068 | 'left': True, |
| 1069 | 'right': False, |
| 1070 | 'labelleft': True, |
| 1071 | 'labelright': False, |
| 1072 | 'gridOn': False, |
| 1073 | 'labelsize': 30, |
| 1074 | 'labelcolor': 'red'} |
| 1075 | >>> ax.yaxis.get_tick_params(which='minor') |
| 1076 | {'left': True, |
| 1077 | 'right': False, |
| 1078 | 'labelleft': True, |
| 1079 | 'labelright': False, |
| 1080 | 'gridOn': False} |
| 1081 | |
| 1082 | |
| 1083 | """ |
| 1084 | _api.check_in_list(['major', 'minor'], which=which) |
| 1085 | if which == 'major': |
| 1086 | return self._translate_tick_params( |
| 1087 | self._major_tick_kw, reverse=True |
| 1088 | ) |
| 1089 | return self._translate_tick_params(self._minor_tick_kw, reverse=True) |
| 1090 | |
| 1091 | @classmethod |
| 1092 | def _translate_tick_params(cls, kw, reverse=False): |