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
XAxisandYAxis.- Attributes:
- isDefault_labelbool
axesAxesThe
Axesinstance the artist resides in, or None.- major
Ticker Determines the major tick positions and their label format.
- minor
Ticker Determines the minor tick positions and their label format.
- callbacks
CallbackRegistry - label
Text The axis label.
- labelpadfloat
The distance between the axis label and the tick labels. Defaults to
rcParams["axes.labelpad"](default:4.0).- offsetText
Text A
Textobject containing the data offset of the ticks (if any).pickradiusfloatThe 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_paramsinstead if possible.- minorTickslist of
Tick The minor ticks.
- Parameters:
- axes
Axes The
Axesto which the created Axis belongs.- pickradiusfloat
The acceptance radius for containment tests. See also
Axis.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.clearwill callAxis.clear. .. versionadded:: 3.8
- axes
- class matplotlib.axis.XAxis(*args, **kwargs)[source]#
- Parameters:
- axes
Axes The
Axesto which the created Axis belongs.- pickradiusfloat
The acceptance radius for containment tests. See also
Axis.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.clearwill callAxis.clear. .. versionadded:: 3.8
- axes
- class matplotlib.axis.YAxis(*args, **kwargs)[source]#
- Parameters:
- axes
Axes The
Axesto which the created Axis belongs.- pickradiusfloat
The acceptance radius for containment tests. See also
Axis.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.clearwill callAxis.clear. .. versionadded:: 3.8
- axes
- class matplotlib.axis.Ticker[source]#
A container for the objects defining tick position and format.
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 a
FixedLocator; it's list of locations is then used by
set_ticklabels to make an appropriate
FuncFormatter.
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 an
XAxis) or for the left and right positions (in case of aYAxis).- Attributes:
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