matplotlib.axis¶
Table of Contents
Classes for the ticks and x and y axis.
Axis objects¶
-
class
matplotlib.axis.Axis(axes, pickradius=15)[source]¶ Base class for
XAxisandYAxis.Parameters: - axes
matplotlib.axes.Axes The
Axesto 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
Axesto 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
Axesto 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.Locatorsubclass Determines the positions of the ticks.
- formatter
matplotlib.ticker.Formattersubclass Determines the format of the tick labels.
- locator
Axis.cla |
Clear this axis. |
Axis.get_scale |
Return this Axis' scale (as a str). |
Formatters and Locators¶
Axis.get_major_formatter |
Get the formatter of the major ticker. |
Axis.get_major_locator |
Get the locator of the major ticker. |
Axis.get_minor_formatter |
Get the formatter of the minor ticker. |
Axis.get_minor_locator |
Get the locator of the minor ticker. |
Axis.set_major_formatter |
Set the formatter of the major ticker. |
Axis.set_major_locator |
Set the locator of the major ticker. |
Axis.set_minor_formatter |
Set the formatter of the minor ticker. |
Axis.set_minor_locator |
Set the locator of the minor ticker. |
Axis.remove_overlapping_locs |
If minor ticker locations that overlap with major ticker locations should be trimmed. |
Axis.get_remove_overlapping_locs |
|
Axis.set_remove_overlapping_locs |
Axis Label¶
Axis.set_label_coords |
Set the coordinates of the label. |
Axis.set_label_position |
Set the label position (top or bottom) |
Axis.set_label_text |
Set the text value of the axis label. |
Axis.get_label_position |
Return the label position (top or bottom) |
Axis.get_label_text |
Get the text of the label. |
Ticks, tick labels and Offset text¶
Axis.get_major_ticks |
Return the list of major Ticks. |
Axis.get_majorticklabels |
Return this Axis' major tick labels, as a list of Text. |
Axis.get_majorticklines |
Return this Axis' major tick lines as a list of Line2Ds. |
Axis.get_majorticklocs |
Return this Axis' major tick locations in data coordinates. |
Axis.get_minor_ticks |
Return the list of minor Ticks. |
Axis.get_minorticklabels |
Return this Axis' minor tick labels, as a list of Text. |
Axis.get_minorticklines |
Return this Axis' minor tick lines as a list of Line2Ds. |
Axis.get_minorticklocs |
Return this Axis' minor tick locations in data coordinates. |
Axis.get_offset_text |
Return the axis offsetText as a Text instance. |
Axis.get_tick_padding |
|
Axis.get_ticklabels |
Get this Axis' tick labels. |
Axis.get_ticklines |
Return this Axis' tick lines as a list of Line2Ds. |
Axis.get_ticklocs |
Return this Axis' tick locations in data coordinates. |
Axis.get_gridlines |
Return this Axis' grid lines as a list of Line2Ds. |
Axis.grid |
Configure the grid lines. |
Axis.set_tick_params |
Set appearance parameters for ticks, ticklabels, and gridlines. |
Axis.axis_date |
Sets up axis ticks and labels to treat data along this Axis as dates. |
Data and view intervals¶
Axis.get_data_interval |
Return the Interval instance for this axis data limits. |
Axis.get_view_interval |
Return the view limits (min, max) of this axis. |
Axis.set_data_interval |
Set the axis data limits. |
Axis.set_view_interval |
Set the axis view limits. |
Rendering helpers¶
Axis.get_minpos |
|
Axis.get_tick_space |
Return the estimated number of ticks that can fit on the axis. |
Axis.get_ticklabel_extents |
Get the extents of the tick labels on either side of the axes. |
Axis.get_tightbbox |
Return a bounding box that encloses the axis. |
Interactive¶
Axis.contains |
Test whether the artist contains the mouse event. |
Axis.get_pickradius |
Return the depth of the axis used by the picker. |
Axis.set_pickradius |
Set the depth of the axis used by the picker. |
Units¶
Axis.convert_units |
|
Axis.set_units |
Set the units for axis. |
Axis.get_units |
Return the units for axis. |
Axis.update_units |
Introspect data for units converter and update the axis.converter instance if necessary. |
XAxis Specific¶
XAxis.axis_name |
Read-only name identifying the axis. |
XAxis.get_text_heights |
Return how much space should be reserved for text above and below the axes, as a pair of floats. |
XAxis.get_ticks_position |
Return the ticks position ("top", "bottom", "default", or "unknown"). |
XAxis.set_ticks_position |
Set the ticks position. |
XAxis.tick_bottom |
Move ticks and ticklabels (if present) to the bottom of the axes. |
XAxis.tick_top |
Move ticks and ticklabels (if present) to the top of the axes. |
YAxis Specific¶
YAxis.axis_name |
Read-only name identifying the axis. | ||
YAxis.get_text_widths |
|||
YAxis.get_ticks_position |
Return the ticks position ("left", "right", "default", or "unknown"). | ||
YAxis.set_offset_position |
|
||
YAxis.set_ticks_position |
Set the ticks position. | ||
YAxis.tick_left |
Move ticks and ticklabels (if present) to the left of the axes. | ||
YAxis.tick_right |
Move ticks and ticklabels (if present) to the right of the axes. |
Other¶
Axis.OFFSETTEXTPAD |
|
Axis.axes |
The Axes instance the artist resides in, or None. |
Axis.limit_range_for_scale |
|
Axis.reset_ticks |
Re-initialize the major and minor Tick lists. |
Axis.set_default_intervals |
Set the default limits for the axis data and view interval if they have not been not mutated yet. |
Axis.get_smart_bounds |
[Deprecated] Return whether the axis has smart bounds. |
Axis.set_smart_bounds |
[Deprecated] Set the axis to have smart bounds. |
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.
Axis.set_ticks |
Set this Axis' tick locations. |
Axis.set_ticklabels |
Set the text values of the tick labels. |
Tick objects¶
-
class
matplotlib.axis.Tick(axes, loc, label=<deprecated parameter>, 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, **kw)[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

