You are reading an old version of the documentation (v3.0.0). For the latest version see https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.tick_params.html
Version 3.0.0
matplotlib
Fork me on GitHub

Table Of Contents

matplotlib.axes.Axes.tick_params

Axes.tick_params(axis='both', **kwargs)

Change the appearance of ticks, tick labels, and gridlines.

Parameters:
axis : {'x', 'y', 'both'}, optional

Which axis to apply the parameters to.

Other Parameters:
axis : {'x', 'y', 'both'}

Axis on which to operate; default is 'both'.

reset : bool

If True, set all parameters to defaults before processing other keyword arguments. Default is False.

which : {'major', 'minor', 'both'}

Default is 'major'; apply arguments to which ticks.

direction : {'in', 'out', 'inout'}

Puts ticks inside the axes, outside the axes, or both.

length : float

Tick length in points.

width : float

Tick width in points.

color : color

Tick color; accepts any mpl color spec.

pad : float

Distance in points between tick and label.

labelsize : float or str

Tick label font size in points or as a string (e.g., 'large').

labelcolor : color

Tick label color; mpl color spec.

colors : color

Changes the tick color and the label color to the same value: mpl color spec.

zorder : float

Tick and label zorder.

bottom, top, left, right : bool

Whether to draw the respective ticks.

labelbottom, labeltop, labelleft, labelright : bool

Whether to draw the respective tick labels.

labelrotation : float

Tick label rotation

grid_color : color

Changes the gridline color to the given mpl color spec.

grid_alpha : float

Transparency of gridlines: 0 (transparent) to 1 (opaque).

grid_linewidth : float

Width of gridlines in points.

grid_linestyle : string

Any valid Line2D line style spec.

Examples

Usage

ax.tick_params(direction='out', length=6, width=2, colors='r',
               grid_color='r', grid_alpha=0.5)

This will make all major ticks be red, pointing out of the box, and with dimensions 6 points by 2 points. Tick labels will also be red. Gridlines will be red and translucent.

Examples using matplotlib.axes.Axes.tick_params