matplotlib.axis
#
Classes for the ticks and x and y axis.
Inheritance#
Axis
objects#
- class matplotlib.axis.Axis(axes, *, pickradius=15)[source]#
Base class for
XAxis
andYAxis
.- Attributes:
- isDefault_labelbool
axes
matplotlib.axes.Axes
The
Axes
instance the artist resides in, or None.- major
matplotlib.axis.Ticker
Determines the major tick positions and their label format.
- minor
matplotlib.axis.Ticker
Determines the minor tick positions and their label format.
- callbacks
matplotlib.cbook.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
) = 4.- offsetText
Text
A
Text
object containing the data offset of the ticks (if any).pickradius
floatThe acceptance radius for containment tests.
- majorTickslist of
Tick
The major ticks.
- minorTickslist of
Tick
The minor ticks.
- Parameters:
- axes
matplotlib.axes.Axes
The
Axes
to which the created Axis belongs.- pickradiusfloat
The acceptance radius for containment tests. See also
Axis.contains
.
- axes
- class matplotlib.axis.XAxis(*args, **kwargs)[source]#
- Parameters:
- axes
matplotlib.axes.Axes
The
Axes
to which the created Axis belongs.- pickradiusfloat
The acceptance radius for containment tests. See also
Axis.contains
.
- axes
- class matplotlib.axis.YAxis(*args, **kwargs)[source]#
- Parameters:
- axes
matplotlib.axes.Axes
The
Axes
to which the created Axis belongs.- pickradiusfloat
The acceptance radius for containment tests. See also
Axis.contains
.
- axes
- class matplotlib.axis.Ticker[source]#
A container for the objects defining tick position and format.
- Attributes:
- locator
matplotlib.ticker.Locator
subclass Determines the positions of the ticks.
- formatter
matplotlib.ticker.Formatter
subclass Determines the format of the tick labels.
- locator
Clear the axis. |
|
Return this Axis' scale (as a str). |
Formatters and Locators#
Get the formatter of the major ticker. |
|
Get the locator of the major ticker. |
|
Get the formatter of the minor ticker. |
|
Get the locator of the minor ticker. |
|
Set the formatter of the major ticker. |
|
Set the locator of the major ticker. |
|
Set the formatter of the minor ticker. |
|
Set the locator of the minor ticker. |
|
If minor ticker locations that overlap with major ticker locations should be trimmed. |
|
Axis Label#
Set the coordinates of the label. |
|
Set the label position (top or bottom) |
|
Set the text value of the axis label. |
|
Return the axis label as a Text instance. |
|
Return the label position (top or bottom) |
|
Get the text of the label. |
Ticks, tick labels and Offset text#
Return the list of major |
|
Return this Axis' major tick labels, as a list of |
|
Return this Axis' major tick lines as a list of |
|
Return this Axis' major tick locations in data coordinates. |
|
Return the list of minor |
|
Return this Axis' minor tick labels, as a list of |
|
Return this Axis' minor tick lines as a list of |
|
Return this Axis' minor tick locations in data coordinates. |
|
Return the axis offsetText as a Text instance. |
|
Get this Axis' tick labels. |
|
Return this Axis' tick lines as a list of |
|
Return this Axis' tick locations in data coordinates. |
|
Return this Axis' grid lines as a list of |
|
Configure the grid lines. |
|
Set appearance parameters for ticks, ticklabels, and gridlines. |
|
Set up axis ticks and labels to treat data along this Axis as dates. |
Data and view intervals#
Return the |
|
Return the |
|
Return whether this Axis is oriented in the "inverse" direction. |
|
Set the axis data limits. |
|
Set the axis view limits. |
|
Set whether this Axis is oriented in the "inverse" direction. |
Rendering helpers#
Return the estimated number of ticks that can fit on the axis. |
|
[Deprecated] Get the extents of the tick labels on either side of the axes. |
|
Return a bounding box that encloses the axis. |
Interactive#
Test whether the artist contains the mouse event. |
|
The acceptance radius for containment tests. |
|
Return the depth of the axis used by the picker. |
|
Set the depth of the axis used by the picker. |
Units#
Set the units for axis. |
|
Return the units for axis. |
|
Introspect data for units converter and update the axis.converter instance if necessary. |
XAxis Specific#
Read-only name identifying the axis. |
|
[Deprecated] Return how much space should be reserved for text above and below the Axes, as a pair of floats. |
|
Return the ticks position ("top", "bottom", "default", or "unknown"). |
|
Set the ticks position. |
|
Set the label position (top or bottom) |
|
Move ticks and ticklabels (if present) to the bottom of the Axes. |
|
Move ticks and ticklabels (if present) to the top of the Axes. |
YAxis Specific#
Read-only name identifying the axis. |
|
[Deprecated] |
|
Return the ticks position ("left", "right", "default", or "unknown"). |
|
|
|
Set the ticks position. |
|
Set the label position (left or right) |
|
Move ticks and ticklabels (if present) to the left of the Axes. |
|
Move ticks and ticklabels (if present) to the right of the Axes. |
Other#
The |
|
Re-initialize the major and minor Tick lists. |
|
Set the default limits for the axis data and view interval if they have not been not mutated yet. |
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
.
Set this Axis' tick locations and optionally labels. |
|
[Discouraged] Set the text values of the tick labels. |
Tick
objects#
- class matplotlib.axis.Tick(axes, loc, *, size=None, width=None, color=None, tickdir=None, pad=None, labelsize=None, labelcolor=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
- 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
Return the tick location (data coords) as a scalar. |
|
Get the value of the tick label pad in points. |
|
[Deprecated] |
|
Get the length of the tick outside of the Axes. |
|
Return the view limits |
|
Set the label1 text. |
|
Set the label2 text. |
|
Set the tick label pad in points |
|
Set the url of label1 and label2. |
|
Set the location of tick in data coords with scalar loc. |