matplotlib.axis — Matplotlib 3.10.3 documentation (original) (raw)
Table of Contents
Classes for the ticks and x- and y-axis.
Inheritance#
Axis objects#
class matplotlib.axis.Axis(axes, *, pickradius=15, clear=True)[source]#
Base class for XAxis and YAxis.
Attributes:
isDefault_labelbool
The Axes instance the artist resides in, or None.
majorTicker
Determines the major tick positions and their label format.
minorTicker
Determines the minor tick positions and their label format.
callbacksCallbackRegistry
labelText
The axis label.
labelpadfloat
The distance between the axis label and the tick labels. Defaults to [rcParams["axes.labelpad"]](../users/explain/customizing.html?highlight=axes.labelpad#matplotlibrc-sample)
(default: 4.0
).
offsetTextText
A Text object containing the data offset of the ticks (if any).
pickradiusfloat
The acceptance radius for containment tests.
majorTickslist of Tick
The major ticks.
Warning
Ticks are not guaranteed to be persistent. Various operations can create, delete and modify the Tick instances. There is an imminent risk that changes to individual ticks will not survive if you work on the figure further (including also panning/zooming on a displayed figure).
Working on the individual ticks is a method of last resort. Use set_tick_params instead if possible.
minorTickslist of Tick
The minor ticks.
Parameters:
axesAxes
The Axes to which the created Axis belongs.
pickradiusfloat
The acceptance radius for containment tests. See alsoAxis.contains.
clearbool, default: True
Whether to clear the Axis on creation. This is not required, e.g., when creating an Axis as part of an Axes, as Axes.clear
will callAxis.clear
. .. versionadded:: 3.8
class matplotlib.axis.XAxis(*args, **kwargs)[source]#
Parameters:
axesAxes
The Axes to which the created Axis belongs.
pickradiusfloat
The acceptance radius for containment tests. See alsoAxis.contains.
clearbool, default: True
Whether to clear the Axis on creation. This is not required, e.g., when creating an Axis as part of an Axes, as Axes.clear
will callAxis.clear
. .. versionadded:: 3.8
class matplotlib.axis.YAxis(*args, **kwargs)[source]#
Parameters:
axesAxes
The Axes to which the created Axis belongs.
pickradiusfloat
The acceptance radius for containment tests. See alsoAxis.contains.
clearbool, default: True
Whether to clear the Axis on creation. This is not required, e.g., when creating an Axis as part of an Axes, as Axes.clear
will callAxis.clear
. .. versionadded:: 3.8
class matplotlib.axis.Ticker[source]#
A container for the objects defining tick position and format.
Attributes:
locatorLocator subclass
Determines the positions of the ticks.
formatterFormatter subclass
Determines the format of the tick labels.
Formatters and Locators#
Axis Label#
Ticks, tick labels and Offset text#
Data and view intervals#
Rendering helpers#
Interactive#
Units#
XAxis Specific#
YAxis Specific#
Other#
Discouraged#
These methods should be used together with care, calling set_ticks
to specify the desired tick locations before calling set_ticklabels
to specify a matching series of labels. Calling set_ticks
makes aFixedLocator; it's list of locations is then used byset_ticklabels
to make an appropriateFuncFormatter.
Tick objects#
class matplotlib.axis.Tick(axes, loc, *, size=None, width=None, color=None, tickdir=None, pad=None, labelsize=None, labelcolor=None, labelfontfamily=None, zorder=None, gridOn=None, tick1On=True, tick2On=True, label1On=True, label2On=False, major=True, labelrotation=0, grid_color=None, grid_linestyle=None, grid_linewidth=None, grid_alpha=None, **kwargs)[source]#
Abstract base class for the axis ticks, grid lines and labels.
Ticks mark a position on an Axis. They contain two lines as markers and two labels; one each for the bottom and top positions (in case of anXAxis) or for the left and right positions (in case of a YAxis).
Attributes:
tick1lineLine2D
The left/bottom tick marker.
tick2lineLine2D
The right/top tick marker.
gridlineLine2D
The grid line associated with the label position.
label1Text
The left/bottom tick label.
label2Text
The right/top tick label.
bbox is the Bound2D bounding box in display coords of the Axes loc is the tick location in data coords size is the tick size in points
class matplotlib.axis.XTick(*args, **kwargs)[source]#
Contains all the Artists needed to make an x tick - the tick line, the label text and the grid line
bbox is the Bound2D bounding box in display coords of the Axes loc is the tick location in data coords size is the tick size in points
class matplotlib.axis.YTick(*args, **kwargs)[source]#
Contains all the Artists needed to make a Y tick - the tick line, the label text and the grid line
bbox is the Bound2D bounding box in display coords of the Axes loc is the tick location in data coords size is the tick size in points