Axes

class Axes(*args, number=None, sharex=0, sharey=0, spanx=None, spany=None, alignx=None, aligny=None, main=False, **kwargs)[source]

Bases: matplotlib.axes._axes.Axes

Lowest-level axes subclass. Handles titles and axis sharing. Adds several new methods and overrides existing ones.

Parameters
  • number (int) – The subplot number, used for a-b-c labelling (see format).

  • sharex, sharey ({3, 2, 1, 0}, optional) – The “axis sharing level” for the x axis, y axis, or both axes. See subplots for details.

  • spanx, spany (bool, optional) – Boolean toggle for whether spanning labels are enabled for the x and y axes. See subplots for details.

  • alignx, aligny (bool, optional) – Boolean toggle for whether aligned axis labels are enabled for the x and y axes. See subplots for details.

  • main (bool, optional) – Used internally, indicates whether this is a “main axes” rather than a twin, panel, or inset axes.

Attributes Summary

number

The axes number, controls a-b-c label order and order of appearence in the subplot_grid returned by subplots.

Methods Summary

area(*args, **kwargs)

Alias for fill_between.

areax(*args, **kwargs)

Alias for fill_betweenx.

boxes(*args, **kwargs)

Alias for boxplot.

colorbar(*args[, loc, pad, length, width, …])

Adds colorbar as an inset or along the outside edge of the axes.

context(*[, mode, rc_kw])

For internal use.

draw([renderer])

Adds post-processing steps before axes is drawn.

format(*[, title, top, figtitle, suptitle, …])

Called by XYAxes.format, ProjAxes.format, and PolarAxes.format.

get_size_inches()

Returns the width and the height of the axes in inches.

get_tightbbox(renderer, *args, **kwargs)

Adds post-processing steps before tight bounding box is calculated, and stores the bounding box as an attribute.

heatmap(*args, **kwargs)

Calls pcolormesh and applies default formatting that is suitable for heatmaps: no gridlines, no minor ticks, and major ticks at the center of each grid box.

indicate_inset_zoom([alpha, lw, linewidth, …])

Called automatically when using inset with zoom=True.

inset(bounds, *[, transform, zorder, zoom, …])

Alias for inset_axes.

inset_axes(bounds, *[, transform, zorder, …])

Like the builtin inset_axes method, but draws an inset XYAxes axes and adds some options.

legend(*args[, loc, width, space])

Adds an inset legend or outer legend along the edge of the axes.

panel(side, **kwargs)

Alias for panel_axes.

panel_axes(side, **kwargs)

Returns a panel drawn along the edge of an axes.

parametric(*args[, values, cmap, norm, interp])

Invoked when you pass the cmap keyword argument to plot.

violins(*args, **kwargs)

Alias for violinplot.