详细参考官方文档:http://matplotlib.org/api/axis_api.html
Classes for the ticks and x and y axis
Inheritance
Inheritance diagram of Tick, Ticker, XAxis, YAxis, XTick, YTick
Axis
objects
class
matplotlib.axis.
Axis
(
axes
,
pickradius=15
)
Public attributes
- axes.transData - transform data coords to display coords
- axes.transAxes - transform axis coords to display coords
- labelpad - number of points between the axis and its label
Init the axis with the parent Axes instance
class
matplotlib.axis.
XAxis
(
axes
,
pickradius=15
)
Init the axis with the parent Axes instance
class
matplotlib.axis.
YAxis
(
axes
,
pickradius=15
)
Init the axis with the parent Axes instance
class
matplotlib.axis.
Ticker
Axis.cla
|
clear the current axis
|
Axis.get_scale
| |
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 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
|
Sets 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
|
get the tick instances; grow as necessary
|
Axis.get_majorticklabels
|
Return a list of Text instances for the major ticklabels
|
Axis.get_majorticklines
|
Return the major tick lines as a list of Line2D instances
|
Axis.get_majorticklocs
|
Get the major tick locations in data coordinates as a numpy array
|
Axis.get_minor_ticks
|
get the minor tick instances; grow as necessary
|
Axis.get_minorticklabels
|
Return a list of Text instances for the minor ticklabels
|
Axis.get_minorticklines
|
Return the minor tick lines as a list of Line2D instances
|
Axis.get_minorticklocs
|
Get the minor tick locations in data coordinates as a numpy array
|
Axis.get_offset_text
|
Return the axis offsetText as a Text instance
|
Axis.get_tick_padding
| |
Axis.get_ticklabels
|
Get the x tick labels as a list of Text instances.
|
Axis.get_ticklines
|
Return the tick lines as a list of Line2D instances
|
Axis.get_ticklocs
|
Get the tick locations in data coordinates as a numpy array
|
Axis.get_gridlines
|
Return the grid lines as a list of Line2D instance
|
Axis.grid
|
Set the axis grid on or off; b is a boolean.
|
Data and view intervals
Axis.get_data_interval
|
return the Interval instance for this axis data limits
|
Axis.get_view_interval
|
return the Interval instance for this axis view limits
|
Axis.set_data_interval
|
set the axis data limits
|
Axis.set_view_interval
| |
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.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
|
Incremental navigation
Axis.pan
|
Pan numsteps (can be positive or negative)
|
Axis.zoom
|
Zoom in/out on axis; if direction is >0 zoom in, else zoom out
|
YAxis Specific
YAxis.axis_name
| |
YAxis.get_text_widths
| |
YAxis.get_ticks_position
|
Return the ticks position (left, right, both or unknown)
|
YAxis.set_offset_position
| |
YAxis.set_ticks_position
|
Set the ticks position (left, right, both, default or none) ‘both’ sets the ticks to appear on both positions, but does not change the tick labels.
|
YAxis.tick_left
|
use ticks only on left
|
| |
XAxis Specific
XAxis.axis_name
| |
XAxis.get_text_heights
|
Returns the amount of space one should reserve for text above and below the axes.
|
XAxis.get_ticks_position
|
Return the ticks position (top, bottom, default or unknown)
|
XAxis.set_ticks_position
|
Set the ticks position (top, bottom, both, default or none) both sets the ticks to appear on both positions, but does not change the tick labels.
|
XAxis.tick_bottom
|
use ticks only on bottom
|
XAxis.tick_top
|
use ticks only on top
|
Other
Axis.OFFSETTEXTPAD
| |
Axis.limit_range_for_scale
| |
Axis.reset_ticks
| |
Axis.set_default_intervals
|
set the default limits for the axis data and view interval if they
|
Axis.get_smart_bounds
|
get whether the axis has smart bounds
|
Axis.set_smart_bounds
|
set the axis to have smart bounds
|
Discouraged
These methods implicitly use
FixedLocator
and
FixedFormatter
. They can be convenient, but ifnot used together may de-couple your tick labels from your data.
Axis.set_ticklabels
|
Set the text values of the tick labels.
|
Axis.set_ticks
|
Set the locations of the tick marks from sequence ticks
|