matplotlib.axes.Axes.set_xticklabels#

Axes.set_xticklabels(labels, *, minor=False, fontdict=None, **kwargs)[source]#

[Discouraged] Set the xaxis' tick labels with list of string labels.

Discouraged

The use of this method is discouraged, because of the dependency on tick positions. In most cases, you'll want to use Axes.set_[x/y/z]ticks(positions, labels) or Axes.set_xticks instead.

If you are using this method, you should always fix the tick positions before, e.g. by using Axes.set_xticks or by explicitly setting a FixedLocator. Otherwise, ticks are free to move and the labels may end up in unexpected positions.

Parameters:
labelssequence of str or of Texts

Texts for labeling each tick location in the sequence set by Axes.set_xticks; the number of labels must match the number of locations.

minorbool

If True, set minor ticks instead of major ticks.

fontdictdict, optional

A dictionary controlling the appearance of the ticklabels. The default fontdict is:

{'fontsize': rcParams['axes.titlesize'],
 'fontweight': rcParams['axes.titleweight'],
 'verticalalignment': 'baseline',
 'horizontalalignment': loc}
**kwargs

Text properties.

Returns:
list of Texts

For each tick, includes tick.label1 if it is visible, then tick.label2 if it is visible, in that order.

Examples using matplotlib.axes.Axes.set_xticklabels#

Managing multiple figures in pyplot

Managing multiple figures in pyplot

Managing multiple figures in pyplot
Zoom region inset axes

Zoom region inset axes

Zoom region inset axes
Boxplots

Boxplots

Boxplots
Rendering math equations using TeX

Rendering math equations using TeX

Rendering math equations using TeX
XKCD

XKCD

XKCD
Colorbar Tick Labelling

Colorbar Tick Labelling

Colorbar Tick Labelling
Constrained Layout Guide

Constrained Layout Guide

Constrained Layout Guide