matplotlib.axis.Axis.set_ticks#

Axis.set_ticks(ticks,labels=None,*,minor=False,**kwargs)[source]#

Set this Axis' tick locations and optionally tick labels.

If necessary, the view limits of the Axis are expanded so that allgiven ticks are visible.

Parameters:
ticks1D array-like

Array of tick locations (either floats or in axis units). The axisLocator is replaced by aFixedLocator.

Pass an empty list (set_ticks([])) to remove all ticks.

Some tick formatters will not label arbitrary tick positions;e.g. log formatters only label decade ticks by default. Insuch a case you can set a formatter explicitly on the axisusingAxis.set_major_formatter or provide formattedlabels yourself.

labelslist of str, optional

Tick labels for each location inticks; must have the same length asticks. If set, the labels are used as is, via aFixedFormatter.If not set, the labels are generated using the axis tickFormatter.

minorbool, default: False

IfFalse, set only the major ticks; ifTrue, only the minor ticks.

**kwargs

Text properties for the labels. Using these is only allowed ifyou passlabels. In other cases, please usetick_params.

Notes

The mandatory expansion of the view limits is an intentional designchoice to prevent the surprise of a non-visible tick. If you needother limits, you should set the limits explicitly after setting theticks.

Examples usingmatplotlib.axis.Axis.set_ticks#

Multiple Axes animation

Multiple Axes animation