@@ -2101,6 +2101,81 @@ def locator_params(self, axis='both', tight=None, **kwargs):
2101
2101
self .yaxis .get_major_locator ().set_params (** kwargs )
2102
2102
self .autoscale_view (tight = tight , scalex = _x , scaley = _y )
2103
2103
2104
+ def tick_params (self , axis = 'both' , ** kwargs ):
2105
+ """
2106
+ Convenience method for changing the appearance of ticks and
2107
+ tick labels.
2108
+
2109
+ Keyword arguments:
2110
+
2111
+ *axis*
2112
+ ['x' | 'y' | 'both'] Axis on which to operate;
2113
+ default is 'both'.
2114
+
2115
+ *reset*
2116
+ [True | False] If *True*, set all parameters to defaults
2117
+ before processing other keyword arguments. Default is
2118
+ *False*.
2119
+
2120
+ *which*
2121
+ ['major' | 'minor' | 'both'] Default is 'major': apply
2122
+ arguments to major ticks only.
2123
+
2124
+ *direction*
2125
+ ['in' | 'out'] Puts ticks inside or outside the axes.
2126
+
2127
+ *length*
2128
+ Tick length in points.
2129
+
2130
+ *width*
2131
+ Tick width in points.
2132
+
2133
+ *color*
2134
+ Tick color; accepts any mpl color spec.
2135
+
2136
+ *pad*
2137
+ Distance in points between tick and label.
2138
+
2139
+ *labelsize*
2140
+ Tick label font size in points or as a string (e.g. 'large').
2141
+
2142
+ *labelcolor*
2143
+ Tick label color; mpl color spec.
2144
+
2145
+ *colors*
2146
+ Changes the tick color and the label color to the same value:
2147
+ mpl color spec.
2148
+
2149
+ *zorder*
2150
+ Tick and label zorder.
2151
+
2152
+ *bottom*, *top*, *left*, *right*
2153
+ Boolean or ['on' | 'off'], controls whether to draw the
2154
+ respective ticks.
2155
+
2156
+ *labelbottom*, *labeltop*, *labelleft*, *labelright*
2157
+ Boolean or ['on' | 'off'], controls whether to draw the
2158
+ respective tick labels.
2159
+
2160
+ Example::
2161
+
2162
+ ax.tick_params(direction='out', length=6, width=2, colors='r')
2163
+
2164
+ This will make all major ticks be red, pointing out of the box,
2165
+ and with dimensions 6 points by 2 points. Tick labels will
2166
+ also be red.
2167
+
2168
+ """
2169
+ if axis in ['x' , 'both' ]:
2170
+ xkw = dict (kwargs )
2171
+ xkw .pop ('top' , None )
2172
+ xkw .pop ('bottom' , None )
2173
+ self .xaxis .set_tick_params (** xkw )
2174
+ if axis in ['y' , 'both' ]:
2175
+ ykw = dict (kwargs )
2176
+ ykw .pop ('left' , None )
2177
+ ykw .pop ('right' , None )
2178
+ self .yaxis .set_tick_params (** ykw )
2104
2179
2105
2180
def set_axis_off (self ):
2106
2181
"""turn off the axis"""
0 commit comments