Return the Figure instance the artist belongs to.


Return boolean flag, True if artist is included in layout calculations.
E.g. Constrained Layout Guide, Figure.tight_layout(), and fig.savefig(fname, bbox_inches='tight').


Return the label used for this artist in the legend.


Return the picking behavior of the artist.
The possible values are described in set_picker.
See also


Return whether the artist is to be rasterized.


Return the sketch parameters for the artist.
A 3-tuple with the following elements:
Returns None if no sketch parameters were set.


Return the snap setting.
See set_snap for details.


Return the Transform instance used by this artist.


Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.


Get the artist's bounding box in display space.
The bounding box' width and height are nonnegative.
Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.


Return whether units are set on any axis.


Return whether the Artist has an explicitly set transform.
This is True after set_transform has been called.


If this property is set to True, the artist will be queried for custom context information when the mouse cursor moves over it.
See also get_cursor_data(), ToolCursorPosition and NavigationToolbar2.


Call all of the registered callbacks.
This function is triggered internally when a property is changed.
See also


Process a pick event.
Each child artist will fire a pick event if mouseevent is over the artist and the artist has picker set.
See also


Return whether the artist is pickable.
See also


Return a dictionary of all the properties of the artist.


Remove the artist from the figure if possible.
The effect will not be visible until the figure is redrawn, e.g., with FigureCanvasBase.draw_idle. Call relim to update the axes limits if desired.
Note: relim will not see collections even if the collection was added to the axes with autolim = True.
Note: there is no support for removing the artist's legend entry.


Remove a callback based on its observer id.
See also


Set multiple properties at once.
Supported properties are
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
scalar or None
animated
bool
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
figure
Figure
gid
str
in_layout
bool
label
object
path_effects
AbstractPathEffect
picker
None or bool or float or callable
rasterized
bool
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
transform
Transform
url
str
visible
bool
zorder
float


Set the agg filter.
A filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array.


Set the alpha value used for blending - not supported on all backends.
alpha must be within the 0-1 range, inclusive.


Set whether the artist is intended to be used in an animation.
If True, the artist is excluded from regular drawing of the figure. You have to call Figure.draw_artist / Axes.draw_artist explicitly on the artist. This appoach is used to speed up animations using blitting.
See also matplotlib.animation and Faster rendering by using blitting.


Set whether the artist uses clipping.
When False artists will be visible outside of the axes which can lead to unexpected results.


Set the artist's clip path.
The clip path. If given a Path, transform must be provided as well. If None, a previously set clip path is removed.
Only used if path is a Path, in which case the given Path is converted to a TransformedPath using transform.
For efficiency, if path is a Rectangle this method will set the clipping box to the corresponding rectangle and set the clipping path to None.
For technical reasons (support of set), a tuple (path, transform) is also accepted as a single positional parameter.


Set the Figure instance the artist belongs to.


Set if artist is to be included in layout calculations, E.g. Constrained Layout Guide, Figure.tight_layout(), and fig.savefig(fname, bbox_inches='tight').


Set a label that will be displayed in the legend.
s will be converted to a string by calling str.


Define the picking behavior of the artist.
This can be one of the following:
A function: If picker is callable, it is a user supplied function which determines whether the artist is hit by the mouse event:
to determine the hit test. if the mouse event is over the artist, return hit=True and props is a dictionary of properties you want added to the PickEvent attributes.


Force rasterized (bitmap) drawing for vector graphics output.
Rasterized drawing is not supported by all artists. If you try to enable this on an artist that does not support it, the command has no effect and a warning will be issued.
This setting is ignored for pixel-based output.
See also Rasterization for vector graphics.


Set the sketch parameters.
The amplitude of the wiggle perpendicular to the source line, in pixels. If scale is None, or not provided, no sketch filter will be provided.
The length of the wiggle along the line, in pixels (default 128.0)
The scale factor by which the length is shrunken or expanded (default 16.0)
The PGF backend uses this argument as an RNG seed and not as described above. Using the same seed yields the same random shape.


Set the snapping behavior.
Snapping aligns positions with the pixel grid, which results in clearer images. For example, if a black line of 1px width was defined at a position in between two pixels, the resulting image would contain the interpolated value of that line in the pixel grid, which would be a grey value on both adjacent pixel positions. In contrast, snapping will move the line to the nearest integer pixel value, so that the resulting image will really contain a 1px wide black line.
Snapping is currently only supported by the Agg and MacOSX backends.
Possible values:


Set the zorder for the artist. Artists with lower zorder values are drawn first.


Whether the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.


x and y sticky edge lists for autoscaling.
When performing autoscaling, if a data limit coincides with a value in the corresponding sticky_edges list, then no margin will be added--the view limit "sticks" to the edge. A typical use case is histograms, where one usually expects no margin on the bottom edge (0) of the histogram.
Moreover, margin expansion "bumps" against sticky edges and cannot cross them. For example, if the upper data limit is 1.0, the upper view limit computed by simple margin application is 1.2, but there is a sticky edge at 1.1, then the actual upper view limit will be 1.1.
This attribute cannot be assigned to; however, the x and y lists can be modified in place as needed.


Update this artist's properties from the dict props.


A helper class to inspect an Artist and return information about its settable properties and their current values.
Initialize the artist inspector with an Artist or an iterable of Artists. If an iterable is used, we assume it is a homogeneous sequence (all Artists are of the same type) and it is your responsibility to make sure this is so.
Initialize the artist inspector with an Artist or an iterable of Artists. If an iterable is used, we assume it is a homogeneous sequence (all Artists are of the same type) and it is your responsibility to make sure this is so.
__init__(o)
Initialize the artist inspector with an Artist or an iterable of Artists.
aliased_name(s)
Return 'PROPNAME or alias' if s has an alias, else return 'PROPNAME'.
aliased_name_rest(s, target)
Return 'PROPNAME or alias' if s has an alias, else return 'PROPNAME', formatted for reST.
get_aliases()
Get a dict mapping property fullnames to sets of aliases for each alias in the ArtistInspector.
get_setters()
Get the attribute strings with setters for object.
get_valid_values(attr)
Get the legal arguments for the setter associated with attr.
is_alias(o)
Return whether method object o is an alias for another method.
pprint_getters()
Return the getters and actual values as list of strings.
pprint_setters([prop, leadingspace])
If prop is None, return a list of strings of all settable properties and their valid values.
pprint_setters_rest([prop, leadingspace])
If prop is None, return a list of reST-formatted strings of all settable properties and their valid values.
properties()
Return a dictionary mapping property name -> value.
Return 'PROPNAME or alias' if s has an alias, else return 'PROPNAME'.
e.g., for the line markerfacecolor property, which has an alias, return 'markerfacecolor or mfc' and for the transform property, which does not, return 'transform'.
Return 'PROPNAME or alias' if s has an alias, else return 'PROPNAME', formatted for reST.
e.g., for the line markerfacecolor property, which has an alias, return 'markerfacecolor or mfc' and for the transform property, which does not, return 'transform'.
Get a dict mapping property fullnames to sets of aliases for each alias in the ArtistInspector.
e.g., for lines:
Get the attribute strings with setters for object.
For example, for a line, return ['markerfacecolor', 'linewidth',
....].
Get the legal arguments for the setter associated with attr.
This is done by querying the docstring of the setter for a line that begins with "ACCEPTS:" or ".. ACCEPTS:", and then by looking for a numpydoc-style documentation for the setter's first argument.
Return whether method object o is an alias for another method.
Return the getters and actual values as list of strings.
If prop is None, return a list of strings of all settable properties and their valid values.
If prop is not None, it is a valid property name and that property will be returned as a string of property : valid values.
If prop is None, return a list of reST-formatted strings of all settable properties and their valid values.
If prop is not None, it is a valid property name and that property will be returned as a string of "property : valid" values.
Return a dictionary mapping property name -> value.


Initialize the artist inspector with an Artist or an iterable of Artists. If an iterable is used, we assume it is a homogeneous sequence (all Artists are of the same type) and it is your responsibility to make sure this is so.


Return 'PROPNAME or alias' if s has an alias, else return 'PROPNAME'.
e.g., for the line markerfacecolor property, which has an alias, return 'markerfacecolor or mfc' and for the transform property, which does not, return 'transform'.


Return 'PROPNAME or alias' if s has an alias, else return 'PROPNAME', formatted for reST.
e.g., for the line markerfacecolor property, which has an alias, return 'markerfacecolor or mfc' and for the transform property, which does not, return 'transform'.


Get a dict mapping property fullnames to sets of aliases for each alias in the ArtistInspector.
e.g., for lines:


Get the attribute strings with setters for object.
For example, for a line, return ['markerfacecolor', 'linewidth',
....].


Get the legal arguments for the setter associated with attr.
This is done by querying the docstring of the setter for a line that begins with "ACCEPTS:" or ".. ACCEPTS:", and then by looking for a numpydoc-style documentation for the setter's first argument.


Return whether method object o is an alias for another method.


Return the getters and actual values as list of strings.


If prop is None, return a list of strings of all settable properties and their valid values.
If prop is not None, it is a valid property name and that property will be returned as a string of property : valid values.


If prop is None, return a list of reST-formatted strings of all settable properties and their valid values.
If prop is not None, it is a valid property name and that property will be returned as a string of "property : valid" values.


Return a dictionary mapping property name -> value.


Return the value of an Artist's property, or print all of them.
The queried artist; e.g., a Line2D, a Text, or an Axes.
If property is 'somename', this function returns obj.get_somename().
If it's None (or unset), it prints all gettable properties from obj. Many properties have aliases for shorter typing, e.g. 'lw' is an alias for 'linewidth'. In the output, aliases and full property names will be listed as:
property or alias = value
e.g.:
linewidth or lw = 2
See also


Inspect an Artist class (using ArtistInspector) and return information about its settable properties and their current values.
The settable properties of artist, as plain text if rcParams["docstring.hardcopy"] (default: False) is False and as a rst table (intended for use in Sphinx) if it is True.


Set one or more properties on an Artist, or list allowed values.
The artist(s) whose properties are being set or queried. When setting properties, all artists are affected; when querying the allowed values, only the first instance in the sequence is queried.
For example, two lines can be made thicker and red with a single call:
Where setp writes its output when asked to list allowed values.
The default, None, means sys.stdout.
The properties to set. The following combinations are supported:
Set the linestyle of a line to be dashed:
Set multiple properties at once:
List allowed values for a line's linestyle:
List all properties that can be set, and their allowed values:
setp also supports MATLAB style string/value pairs. For example, the following are equivalent:
See also


Table of Contents
Plotting
Axis / limits
Bases: matplotlib.axes._base._AxesBase
The Axes contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system.
The Axes instance supports callbacks through a callbacks attribute which is a CallbackRegistry instance. The events you can connect to are 'xlim_changed' and 'ylim_changed' and the callback will be called with func(ax) where ax is the Axes instance.
The bounding box enclosing all data displayed in the Axes.
The view limits in data coordinates.
Build an Axes in a figure.
The Axes is built in the Figure fig.
The Axes is built in the rectangle rect. rect is in Figure coordinates.
The x or y axis is shared with the x or y axis in the input Axes.
Whether the Axes frame is visible.
Set a fixed aspect for the Axes box, i.e. the ratio of height to width. See set_box_aspect for details.
Other optional keyword arguments:
Property
Description
adjustable
{'box', 'datalim'}
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
scalar or None
anchor
(float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', ...}
animated
bool
aspect
{'auto', 'equal'} or float
autoscale_on
bool
autoscalex_on
bool
autoscaley_on
bool
axes_locator
Callable[[Axes, Renderer], Bbox]
axisbelow
bool or 'line'
box_aspect
float or None
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
facecolor or fc
color
figure
Figure
frame_on
bool
gid
str
in_layout
bool
label
object
navigate
bool
navigate_mode
unknown
path_effects
AbstractPathEffect
picker
None or bool or float or callable
position
[left, bottom, width, height] or Bbox
prop_cycle
unknown
rasterization_zorder
float or None
rasterized
bool
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
title
str
transform
Transform
url
str
visible
bool
xbound
unknown
xlabel
str
xlim
(bottom: float, top: float)
xmargin
float greater than -0.5
xscale
{"linear", "log", "symlog", "logit", ...} or ScaleBase
xticklabels
unknown
xticks
unknown
ybound
unknown
ylabel
str
ylim
(bottom: float, top: float)
ymargin
float greater than -0.5
yscale
{"linear", "log", "symlog", "logit", ...} or ScaleBase
yticklabels
unknown
yticks
unknown
zorder
float
The new Axes object.
SubplotBase
Base class for subplots, which are Axes instances with additional methods to facilitate generating and manipulating a set of Axes within a figure.
subplot_class_factory
Axes.plot
Plot y versus x as lines and/or markers.
Axes.errorbar
Plot y versus x as lines and/or markers with attached errorbars.
Axes.scatter
A scatter plot of y vs.
Axes.plot_date
Plot coercing the axis to treat floats as dates.
Axes.step
Make a step plot.
Axes.loglog
Make a plot with log scaling on both the x and y axis.
Axes.semilogx
Make a plot with log scaling on the x axis.
Axes.semilogy
Make a plot with log scaling on the y axis.
Axes.fill_between
Fill the area between two horizontal curves.
Axes.fill_betweenx
Fill the area between two vertical curves.
Axes.bar
Make a bar plot.
Axes.barh
Make a horizontal bar plot.
Axes.bar_label
Label a bar plot.
Axes.stem
Create a stem plot.
Axes.eventplot
Plot identical parallel lines at the given positions.
Axes.pie
Plot a pie chart.
Axes.stackplot
Draw a stacked area plot.
Axes.broken_barh
Plot a horizontal sequence of rectangles.
Axes.vlines
Plot vertical lines at each x from ymin to ymax.
Axes.hlines
Plot horizontal lines at each y from xmin to xmax.
Axes.fill
Plot filled polygons.
Axes.axhline
Add a horizontal line across the axis.
Axes.axhspan
Add a horizontal span (rectangle) across the Axes.
Axes.axvline
Add a vertical line across the Axes.
Axes.axvspan
Add a vertical span (rectangle) across the Axes.
Axes.axline
Add an infinitely long straight line.
Axes.acorr
Plot the autocorrelation of x.
Axes.angle_spectrum
Plot the angle spectrum.
Axes.cohere
Plot the coherence between x and y.
Axes.csd
Plot the cross-spectral density.
Axes.magnitude_spectrum
Plot the magnitude spectrum.
Axes.phase_spectrum
Plot the phase spectrum.
Axes.psd
Plot the power spectral density.
Axes.specgram
Plot a spectrogram.
Axes.xcorr
Plot the cross correlation between x and y.
Axes.boxplot
Draw a box and whisker plot.
Axes.violinplot
Make a violin plot.
Axes.violin
Drawing function for violin plots.
Axes.bxp
Drawing function for box and whisker plots.
Axes.hexbin
Make a 2D hexagonal binning plot of points x, y.
Axes.hist
Plot a histogram.
Axes.hist2d
Make a 2D histogram plot.
Axes.stairs
A stepwise constant function as a line with bounding edges or a filled plot.
Axes.clabel
Label a contour plot.
Axes.contour
Plot contour lines.
Axes.contourf
Plot filled contours.
Axes.imshow
Display data as an image, i.e., on a 2D regular raster.
Axes.matshow
Plot the values of a 2D matrix or array as color-coded image.
Axes.pcolor
Create a pseudocolor plot with a non-regular rectangular grid.
Axes.pcolorfast
Create a pseudocolor plot with a non-regular rectangular grid.
Axes.pcolormesh
Create a pseudocolor plot with a non-regular rectangular grid.
Axes.spy
Plot the sparsity pattern of a 2D array.
Axes.tripcolor
Create a pseudocolor plot of an unstructured triangular grid.
Axes.triplot
Draw a unstructured triangular grid as lines and/or markers.
Axes.tricontour
Draw contour lines on an unstructured triangular grid.
Axes.tricontourf
Draw contour regions on an unstructured triangular grid.
Axes.annotate
Annotate the point xy with text text.
Axes.text
Add text to the Axes.
Axes.table
Add a table to an Axes.
Axes.arrow
Add an arrow to the Axes.
Axes.inset_axes
Add a child inset Axes to this existing Axes.
Axes.indicate_inset
Add an inset indicator to the Axes.
Axes.indicate_inset_zoom
Add an inset indicator rectangle to the Axes based on the axis limits for an inset_ax and draw connectors between inset_ax and the rectangle.
Axes.secondary_xaxis
Add a second x-axis to this Axes.
Axes.secondary_yaxis
Add a second y-axis to this Axes.
Axes.barbs
Plot a 2D field of barbs.
Axes.quiver
Plot a 2D field of arrows.
Axes.quiverkey
Add a key to a quiver plot.
Axes.streamplot
Draw streamlines of a vector flow.
Axes.cla
Clear the Axes.
Axes.clear
Clear the Axes.
Axes.axis
Convenience method to get or set some axis properties.
Axes.set_axis_off
Turn the x- and y-axis off.
Axes.set_axis_on
Turn the x- and y-axis on.
Axes.set_frame_on
Set whether the Axes rectangle patch is drawn.
Axes.get_frame_on
Get whether the Axes rectangle patch is drawn.
Axes.set_axisbelow
Set whether axis ticks and gridlines are above or below most artists.
Axes.get_axisbelow
Get whether axis ticks and gridlines are above or below most artists.
Axes.grid
Configure the grid lines.
Axes.get_facecolor
Get the facecolor of the Axes.
Axes.set_facecolor
Set the facecolor of the Axes.
Axes.set_prop_cycle
Set the property cycle of the Axes.
Axes.get_xaxis
Return the XAxis instance.
Axes.get_yaxis
Return the YAxis instance.
Axes.invert_xaxis
Invert the x-axis.
Axes.xaxis_inverted
Return whether the xaxis is oriented in the "inverse" direction.
Axes.invert_yaxis
Invert the y-axis.
Axes.yaxis_inverted
Return whether the yaxis is oriented in the "inverse" direction.
Axes.set_xlim
Set the x-axis view limits.
Axes.get_xlim
Return the x-axis view limits.
Axes.set_ylim
Set the y-axis view limits.
Axes.get_ylim
Return the y-axis view limits.
Axes.update_datalim
Extend the dataLim Bbox to include the given points.
Axes.set_xbound
Set the lower and upper numerical bounds of the x-axis.
Axes.get_xbound
Return the lower and upper x-axis bounds, in increasing order.
Axes.set_ybound
Set the lower and upper numerical bounds of the y-axis.
Axes.get_ybound
Return the lower and upper y-axis bounds, in increasing order.
Axes.set_xlabel
Set the label for the x-axis.
Axes.get_xlabel
Get the xlabel text string.
Axes.set_ylabel
Set the label for the y-axis.
Axes.get_ylabel
Get the ylabel text string.
Axes.set_title
Set a title for the Axes.
Axes.get_title
Get an Axes title.
Axes.legend
Place a legend on the Axes.
Axes.get_legend
Return the Legend instance, or None if no legend is defined.
Axes.get_legend_handles_labels
Return handles and labels for legend
Axes.set_xscale
Set the x-axis scale.
Axes.get_xscale
Return the xaxis' scale (as a str).
Axes.set_yscale
Set the y-axis scale.
Axes.get_yscale
Return the yaxis' scale (as a str).
Axes.use_sticky_edges
When autoscaling, whether to obey all Artist.sticky_edges.
Axes.margins
Set or retrieve autoscaling margins.
Axes.set_xmargin
Set padding of X data limits prior to autoscaling.
Axes.set_ymargin
Set padding of Y data limits prior to autoscaling.
Axes.relim
Recompute the data limits based on current artists.
Axes.autoscale
Autoscale the axis view to the data (toggle).
Axes.autoscale_view
Autoscale the view limits using the data limits.
Axes.set_autoscale_on
Set whether autoscaling is applied to each axis on the next draw or call to Axes.autoscale_view.
Axes.get_autoscale_on
Return True if each axis is autoscaled, False otherwise.
Axes.set_autoscalex_on
Set whether the x-axis is autoscaled on the next draw or call to Axes.autoscale_view.
Axes.get_autoscalex_on
Return whether the x-axis is autoscaled.
Axes.set_autoscaley_on
Set whether the y-axis is autoscaled on the next draw or call to Axes.autoscale_view.
Axes.get_autoscaley_on
Return whether the y-axis is autoscaled.
Axes.apply_aspect
Adjust the Axes for a specified data aspect ratio.
Axes.set_aspect
Set the aspect ratio of the axes scaling, i.e. y/x-scale.
Axes.get_aspect
Return the aspect ratio of the axes scaling.
Axes.set_box_aspect
Set the Axes box aspect, i.e. the ratio of height to width.
Axes.get_box_aspect
Return the Axes box aspect, i.e. the ratio of height to width.
Axes.set_adjustable
Set how the Axes adjusts to achieve the required aspect ratio.
Axes.get_adjustable
Return whether the Axes will adjust its physical dimension ('box') or its data limits ('datalim') to achieve the desired aspect ratio.
Axes.set_xticks
Set the xaxis' tick locations and optionally labels.
Axes.get_xticks
Return the xaxis' tick locations in data coordinates.
Axes.set_xticklabels
Set the xaxis' labels with list of string labels.
Axes.get_xticklabels
Get the xaxis' tick labels.
Axes.get_xmajorticklabels
Return the xaxis' major tick labels, as a list of Text.
Axes.get_xminorticklabels
Return the xaxis' minor tick labels, as a list of Text.
Axes.get_xgridlines
Return the xaxis' grid lines as a list of Line2Ds.
Axes.get_xticklines
Return the xaxis' tick lines as a list of Line2Ds.
Axes.xaxis_date
Set up axis ticks and labels to treat data along the xaxis as dates.
Axes.set_yticks
Set the yaxis' tick locations and optionally labels.
Axes.get_yticks
Return the yaxis' tick locations in data coordinates.
Axes.set_yticklabels
Set the yaxis' labels with list of string labels.
Axes.get_yticklabels
Get the yaxis' tick labels.
Axes.get_ymajorticklabels
Return the yaxis' major tick labels, as a list of Text.
Axes.get_yminorticklabels
Return the yaxis' minor tick labels, as a list of Text.
Axes.get_ygridlines
Return the yaxis' grid lines as a list of Line2Ds.
Axes.get_yticklines
Return the yaxis' tick lines as a list of Line2Ds.
Axes.yaxis_date
Set up axis ticks and labels to treat data along the yaxis as dates.
Axes.minorticks_off
Remove minor ticks from the Axes.
Axes.minorticks_on
Display minor ticks on the Axes.
Axes.ticklabel_format
Configure the ScalarFormatter used by default for linear axes.
Axes.tick_params
Change the appearance of ticks, tick labels, and gridlines.
Axes.locator_params
Control behavior of major tick locators.
Axes.convert_xunits
Convert x using the unit type of the xaxis.
Axes.convert_yunits
Convert y using the unit type of the yaxis.
Axes.have_units
Return whether units are set on any axis.
Axes.add_artist
Add an Artist to the Axes; return the artist.
Axes.add_child_axes
Add an AxesBase to the Axes' children; return the child Axes.
Axes.add_collection
Add a Collection to the Axes; return the collection.
Axes.add_container
Add a Container to the axes' containers; return the container.
Axes.add_image
Add an AxesImage to the Axes; return the image.
Axes.add_line
Add a Line2D to the Axes; return the line.
Axes.add_patch
Add a Patch to the Axes; return the patch.
Axes.add_table
Add a Table to the Axes; return the table.
Axes.twinx
Create a twin Axes sharing the xaxis.
Axes.twiny
Create a twin Axes sharing the yaxis.
Axes.sharex
Share the x-axis with other.
Axes.sharey
Share the y-axis with other.
Axes.get_shared_x_axes
Return a reference to the shared axes Grouper object for x axes.
Axes.get_shared_y_axes
Return a reference to the shared axes Grouper object for y axes.
Axes.get_anchor
Get the anchor location.
Axes.set_anchor
Define the anchor location.
Axes.get_axes_locator
Return the axes_locator.
Axes.set_axes_locator
Set the Axes locator.
Axes.reset_position
Reset the active position to the original position.
Axes.get_position
Return the position of the Axes within the figure as a Bbox.
Axes.set_position
Set the Axes position.
Axes.stale
Whether the artist is 'stale' and needs to be re-drawn for the output to match the internal state of the artist.
Axes.pchanged
Call all of the registered callbacks.
Axes.add_callback
Add a callback function that will be called whenever one of the Artist's properties changes.
Axes.remove_callback
Remove a callback based on its observer id.
Axes.can_pan
Return whether this Axes supports any pan/zoom button functionality.
Axes.can_zoom
Return whether this Axes supports the zoom box button functionality.
Axes.get_navigate
Get whether the Axes responds to navigation commands.
Axes.set_navigate
Set whether the Axes responds to navigation toolbar commands.
Axes.get_navigate_mode
Get the navigation toolbar button status: 'PAN', 'ZOOM', or None.
Axes.set_navigate_mode
Set the navigation toolbar button status.
Axes.start_pan
Called when a pan operation has started.
Axes.drag_pan
Called when the mouse moves during a pan operation.
Axes.end_pan
Called when a pan operation completes (when the mouse button is up.)
Axes.format_coord
Return a format string formatting the x, y coordinates.
Axes.format_cursor_data
Return a string representation of data.
Axes.format_xdata
Return x formatted as an x-value.
Axes.format_ydata
Return y formatted as an y-value.
Axes.mouseover
If this property is set to True, the artist will be queried for custom context information when the mouse cursor moves over it.
Axes.in_axes
Return whether the given event (in display coords) is in the Axes.
Axes.contains
Test whether the artist contains the mouse event.
Axes.contains_point
Return whether point (pair of pixel coordinates) is inside the axes patch.
Axes.get_cursor_data
Return the cursor data for a given event.
Axes.get_children
Return a list of the child Artists of this Artist.
Axes.get_images
Return a list of AxesImages contained by the Axes.
Axes.get_lines
Return a list of lines contained by the Axes.
Axes.findobj
Find artist objects.
Axes.draw
Draw the Artist (and its children) using the given renderer.
Axes.draw_artist
Efficiently redraw a single artist.
Axes.redraw_in_frame
Efficiently redraw Axes data, but not axis ticks, labels, etc.
Axes.get_renderer_cache
Axes.get_rasterization_zorder
Return the zorder value below which artists will be rasterized.
Axes.set_rasterization_zorder
Set the zorder threshold for rasterization for vector graphics output.
Axes.get_window_extent
Return the Axes bounding box in display space; args and kwargs are empty.
Axes.get_tightbbox
Return the tight bounding box of the axes, including axis and their decorators (xlabel, title, etc).
Methods used by Axis that must be overridden for non-rectilinear Axes.
Axes.name
Axes.get_xaxis_transform
Get the transformation used for drawing x-axis labels, ticks and gridlines.
Axes.get_yaxis_transform
Get the transformation used for drawing y-axis labels, ticks and gridlines.
Axes.get_data_ratio
Return the aspect ratio of the scaled data.
Axes.get_xaxis_text1_transform
Axes.get_xaxis_text2_transform
Axes.get_yaxis_text1_transform
Axes.get_yaxis_text2_transform
Axes.zorder
Axes.get_default_bbox_extra_artists
Return a default list of artists that are used for the bounding box calculation.
Axes.get_transformed_clip_path_and_affine
Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.
Axes.has_data
Return whether any artists have been added to the Axes.
Axes.set
Set multiple properties at once.


Bases: matplotlib.axes._base._AxesBase
The Axes contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system.
The Axes instance supports callbacks through a callbacks attribute which is a CallbackRegistry instance. The events you can connect to are 'xlim_changed' and 'ylim_changed' and the callback will be called with func(ax) where ax is the Axes instance.
The bounding box enclosing all data displayed in the Axes.
The view limits in data coordinates.
Build an Axes in a figure.
The Axes is built in the Figure fig.
The Axes is built in the rectangle rect. rect is in Figure coordinates.
The x or y axis is shared with the x or y axis in the input Axes.
Whether the Axes frame is visible.
Set a fixed aspect for the Axes box, i.e. the ratio of height to width. See set_box_aspect for details.
Other optional keyword arguments:
Property
Description
adjustable
{'box', 'datalim'}
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
scalar or None
anchor
(float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', ...}
animated
bool
aspect
{'auto', 'equal'} or float
autoscale_on
bool
autoscalex_on
bool
autoscaley_on
bool
axes_locator
Callable[[Axes, Renderer], Bbox]
axisbelow
bool or 'line'
box_aspect
float or None
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
facecolor or fc
color
figure
Figure
frame_on
bool
gid
str
in_layout
bool
label
object
navigate
bool
navigate_mode
unknown
path_effects
AbstractPathEffect
picker
None or bool or float or callable
position
[left, bottom, width, height] or Bbox
prop_cycle
unknown
rasterization_zorder
float or None
rasterized
bool
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
title
str
transform
Transform
url
str
visible
bool
xbound
unknown
xlabel
str
xlim
(bottom: float, top: float)
xmargin
float greater than -0.5
xscale
{"linear", "log", "symlog", "logit", ...} or ScaleBase
xticklabels
unknown
xticks
unknown
ybound
unknown
ylabel
str
ylim
(bottom: float, top: float)
ymargin
float greater than -0.5
yscale
{"linear", "log", "symlog", "logit", ...} or ScaleBase
yticklabels
unknown
yticks
unknown
zorder
float
The new Axes object.


Plot the autocorrelation of x.
A detrending function applied to x. It must have the signature
If True, input vectors are normalised to unit length.
Determines the plot style.
If True, vertical lines are plotted from 0 to the acorr value using Axes.vlines. Additionally, a horizontal line is plotted at y=0 using Axes.axhline.
If False, markers are plotted at the acorr values using Axes.plot.
Number of lags to show. If None, will return all 2 * len(x) - 1 lags.
The lag vector.
The auto correlation vector.
Artist added to the Axes of the correlation:
Horizontal line at 0 if usevlines is True None usevlines is False.
The linestyle for plotting the data points. Only used if usevlines is False.
The marker for plotting the data points. Only used if usevlines is False.
If given, the following parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception):
x
Additional parameters are passed to Axes.vlines and Axes.axhline if usevlines is True; otherwise they are passed to Axes.plot.
The cross correlation is performed with numpy.correlate with mode = "full".
Cross- and Auto-Correlation Demo


Add an Artist to the Axes; return the artist.
Use add_artist only for artists for which there is no dedicated "add" method; and if necessary, use a method such as update_datalim to manually update the dataLim if the artist is to be included in autoscaling.
If no transform has been specified when creating the artist (e.g. artist.get_transform() == None) then the transform is set to ax.transData.
Scatter plots with a legend
BboxImage Demo
Bar of pie
Annotating Plots
AnnotationBbox demo
Using a text as a Path
Ellipse Demo
Anchored Direction Arrow
Axes Grid2
Inset Locator Demo2
Simple Anchored Artists
Anatomy of a figure
Anchored Artists
Artist tests
Anchored Box04
Annotate Explain
Connect Simple01
Simple Annotate01
Simple Legend02
Legend guide
Annotations


Add a callback function that will be called whenever one of the Artist's properties changes.
The callback function. It must have the signature:
where artist is the calling Artist. Return values may exist but are ignored.
The observer id associated with the callback. This id can be used for removing the callback with remove_callback later.
See also


Add an AxesBase to the Axes' children; return the child Axes.
This is the lowlevel version. See axes.Axes.inset_axes.


Add a Collection to the Axes; return the collection.
EventCollection Demo
Using span_where
Creating boxes from error bars using PatchCollection
Reference for Matplotlib artists
Line, Poly and RegularPoly Collection with autoscaling
Ellipse Collection
Line Collection
Circles, Wedges and Polygons
Lasso Demo
MRI With EEG
Artist tests
Autoscaling


Add a Container to the axes' containers; return the container.


Add an AxesImage to the Axes; return the image.
Image Nonuniform


Add a Line2D to the Axes; return the line.
Artist within an artist
Reference for Matplotlib artists
Artist tests
Artist tutorial


Add a Patch to the Axes; return the patch.
Curve with error band
Image Demo
Axes box aspect
Controlling view limits using margins and sticky_edges
Boxplots
Plot a confidence ellipse of a two-dimensional dataset
Annotating Plots
Precise text layout
Compound path
Dolphins
Mmh Donuts!!!
Drawing fancy boxes
Hatch style reference
PathPatch object
Bezier Curve
ggplot style sheet
Inset Locator Demo
Firefox
Integral as the area under a curve
Looking Glass
Path Editor
Poly Editor
Trifinder Event Demo
Viewlims
Changing colors of lines intersecting a box
Building histograms using Rectangles and PolyCollections
Packed-bubble chart
SVG Filter Pie
TickedStroke patheffect
Draw flat objects in 3D plot
Artist tests
Ellipse With Units
Artist tutorial
Legend guide
Path Tutorial
Transformations Tutorial
Specifying Colors
Text properties and layout


Add a Table to the Axes; return the table.


Plot the angle spectrum.
Compute the angle spectrum (wrapped phase spectrum) of x. Data is padded to a length of pad_to and the windowing function window is applied to the signal.
Array or sequence containing the data.
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing the FFT. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to the length of the input signal (i.e. no padding).
The center frequency of x, which offsets the x extents of the plot to reflect the frequency range used when a signal is acquired and then filtered and downsampled to baseband.
The values for the angle spectrum in radians (real valued).
The frequencies corresponding to the elements in spectrum.
The line created by this function.
If given, the following parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception):
x
Keyword arguments control the Line2D properties:
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
scalar or None
animated
bool
antialiased or aa
bool
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
color or c
color
dash_capstyle
CapStyle or {'butt', 'projecting', 'round'}
dash_joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
dashes
sequence of floats (on/off ink in points) or (None, None)
data
(2, N) array or two 1D arrays
drawstyle or ds
{'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'
figure
Figure
fillstyle
{'full', 'left', 'right', 'bottom', 'top', 'none'}
gid
str
in_layout
bool
label
object
linestyle or ls
{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw
float
marker
marker style string, Path or MarkerStyle
markeredgecolor or mec
color
markeredgewidth or mew
float
markerfacecolor or mfc
color
markerfacecoloralt or mfcalt
color
markersize or ms
float
markevery
None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool]
path_effects
AbstractPathEffect
picker
float or callable[[Artist, Event], tuple[bool, dict]]
pickradius
float
rasterized
bool
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
solid_capstyle
CapStyle or {'butt', 'projecting', 'round'}
solid_joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
transform
unknown
url
str
visible
bool
xdata
1D array
ydata
1D array
zorder
float
See also
Plots the magnitudes of the corresponding frequencies.
Plots the unwrapped version of this function.
Can plot the angle spectrum of segments within the signal in a colormap.


Annotate the point xy with text text.
In the simplest form, the text is placed at xy.
Optionally, the text can be displayed in another position xytext. An arrow pointing from the text to the annotated point xy can then be added by defining arrowprops.
The text of the annotation.
The point (x, y) to annotate. The coordinate system is determined by xycoords.
The position (x, y) to place the text at. The coordinate system is determined by textcoords.
The coordinate system that xy is given in. The following types of values are supported:
One of the following strings:
Value
Description
'figure points'
Points from the lower left of the figure
'figure pixels'
Pixels from the lower left of the figure
'figure fraction'
Fraction of figure from lower left
'subfigure points'
Points from the lower left of the subfigure
'subfigure pixels'
Pixels from the lower left of the subfigure
'subfigure fraction'
Fraction of subfigure from lower left
'axes points'
Points from lower left corner of axes
'axes pixels'
Pixels from lower left corner of axes
'axes fraction'
Fraction of axes from lower left
'data'
Use the coordinate system of the object being annotated (default)
'polar'
(theta, r) if not native 'data' coordinates
Note that 'subfigure pixels' and 'figure pixels' are the same for the parent figure, so users who want code that is usable in a subfigure can use 'subfigure pixels'.
A function with one of the following signatures:
where renderer is a RendererBase subclass.
The result of the function is interpreted like the Artist and Transform cases above.
See Advanced Annotations for more details.
The coordinate system that xytext is given in.
All xycoords values are valid as well as the following strings:
Value
Description
'offset points'
Offset (in points) from the xy value
'offset pixels'
Offset (in pixels) from the xy value
The properties used to draw a FancyArrowPatch arrow between the positions xy and xytext. Defaults to None, i.e. no arrow is drawn.
For historical reasons there are two different ways to specify arrows, "simple" and "fancy":
Simple arrow:
If arrowprops does not contain the key 'arrowstyle' the allowed keys are:
Key
Description
width
The width of the arrow in points
headwidth
The width of the base of the arrow head in points
headlength
The length of the arrow head in points
shrink
Fraction of total length to shrink from both ends
?
Any key to matplotlib.patches.FancyArrowPatch
The arrow is attached to the edge of the text box, the exact position (corners or centers) depending on where it's pointing to.
Fancy arrow:
This is used if 'arrowstyle' is provided in the arrowprops.
Valid keys are the following FancyArrowPatch parameters:
Key
Description
arrowstyle
the arrow style
connectionstyle
the connection style
relpos
see below; default is (0.5, 0.5)
patchA
default is bounding box of the text
patchB
default is None
shrinkA
default is 2 points
shrinkB
default is 2 points
mutation_scale
default is text size (in points)
mutation_aspect
default is 1.
?
any key for matplotlib.patches.PathPatch
The exact starting point position of the arrow is defined by relpos. It's a tuple of relative coordinates of the text box, where (0, 0) is the lower left corner and (1, 1) is the upper right corner. Values <0 and >1 are supported and specify points outside the text box. By default (0.5, 0.5) the starting point is centered in the text box.
Whether to draw the annotation when the annotation point xy is outside the axes area.
Additional kwargs are passed to Text.
See also
Broken Barh
Hat graph
Creating a timeline with lines, dates, and text
Combining two subplots using subplots and GridSpec
Labeling a pie and a donut
Scale invariant angle label
Annotating Plots
Annotation arrow style reference
Rendering math equations using TeX
Annotate Transform
Annotating a plot
Annotation Polar
Text Commands
Mmh Donuts!!!
axis_direction demo
Simple Axis Pad
XKCD
Patheffect Demo
Annotation with units
Annotate Explain
Annotate Simple01
Annotate Simple02
Annotate Simple03
Annotate Simple04
Annotate Simple Coord01
Annotate Simple Coord02
Annotate Simple Coord03
Connection styles for annotations
Simple Annotate01
Basic Usage
Faster rendering by using blitting
Transformations Tutorial
Text in Matplotlib Plots
Annotations


Adjust the Axes for a specified data aspect ratio.
Depending on get_adjustable this will modify either the Axes box (position) or the view limits. In the former case, get_anchor will affect the position.
See also
For a description of aspect ratio handling.
Set how the Axes adjusts to achieve the required aspect ratio.
Set the position in case of extra space.
This is called automatically when each Axes is drawn. You may need to call it yourself if you need to update the Axes position and/or view limits before the Figure is drawn.


Add an arrow to the Axes.
This draws an arrow from (x, y) to (x+dx, y+dy).
The x and y coordinates of the arrow base.
The length of the arrow along x and y direction.
Width of full arrow tail.
True if head is to be counted in calculating the length.
Total width of the full arrow head.
Length of arrow head.
Draw the left-half, right-half, or full arrow.
Fraction that the arrow is swept back (0 overhang means triangular shape). Can be negative or greater than one.
If True, the head starts being drawn at coordinate 0 instead of ending at coordinate 0.
Patch properties:
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
unknown
animated
bool
antialiased or aa
bool or None
capstyle
CapStyle or {'butt', 'projecting', 'round'}
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
color
color
edgecolor or ec
color or None
facecolor or fc
color or None
figure
Figure
fill
bool
gid
str
hatch
{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout
bool
joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
label
object
linestyle or ls
{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw
float or None
path_effects
AbstractPathEffect
picker
None or bool or float or callable
rasterized
bool
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
transform
Transform
url
str
visible
bool
zorder
float
The created FancyArrow object.
The resulting arrow is affected by the Axes aspect ratio and limits. This may produce an arrow whose head is not square with its stem. To create an arrow whose head is square with its stem, use annotate() for example:
Arrow Demo


Autoscale the axis view to the data (toggle).
Convenience method for simple axis view autoscaling. It turns autoscaling on or off, and then, if autoscaling for either axis is on, it performs the autoscaling on the specified axis or Axes.
True turns autoscaling on, False turns it off. None leaves the autoscaling state unchanged.
Which axis to operate on.
If True, first set the margins to zero. Then, this argument is forwarded to autoscale_view (regardless of its value); see the description of its behavior there.
Axes box aspect
Autoscaling


Autoscale the view limits using the data limits.
If True, only expand the axis limits using the margins. Note that unlike for autoscale, tight=True does not set the margins to zero.
If False and rcParams["axes.autolimit_mode"] (default: 'data') is 'round_numbers', then after expansion by the margins, further expand the axis limits using the axis major locator.
If None (the default), reuse the value set in the previous call to autoscale_view (the initial value is False, but the default style sets rcParams["axes.autolimit_mode"] (default: 'data') to 'data', in which case this behaves like True).
Whether to autoscale the x axis.
Whether to autoscale the y axis.
The autoscaling preserves any preexisting axis direction reversal.
The data limits are not updated automatically when artist data are changed after the artist has been added to an Axes instance. In that case, use matplotlib.axes.Axes.relim() prior to calling autoscale_view.
If the views of the Axes are fixed, e.g. via set_xlim, they will not be changed by autoscale_view(). See matplotlib.axes.Axes.autoscale() for an alternative.
Line, Poly and RegularPoly Collection with autoscaling
Compound path
Ellipse Collection
Packed-bubble chart
Group barchart with units
Textbox
Autoscaling


Add a horizontal line across the axis.
y position in data coordinates of the horizontal line.
Should be between 0 and 1, 0 being the far left of the plot, 1 the far right of the plot.
Should be between 0 and 1, 0 being the far left of the plot, 1 the far right of the plot.
Valid keyword arguments are Line2D properties, with the exception of 'transform':
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
scalar or None
animated
bool
antialiased or aa
bool
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
color or c
color
dash_capstyle
CapStyle or {'butt', 'projecting', 'round'}
dash_joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
dashes
sequence of floats (on/off ink in points) or (None, None)
data
(2, N) array or two 1D arrays
drawstyle or ds
{'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'
figure
Figure
fillstyle
{'full', 'left', 'right', 'bottom', 'top', 'none'}
gid
str
in_layout
bool
label
object
linestyle or ls
{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw
float
marker
marker style string, Path or MarkerStyle
markeredgecolor or mec
color
markeredgewidth or mew
float
markerfacecolor or mfc
color
markerfacecoloralt or mfcalt
color
markersize or ms
float
markevery
None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool]
path_effects
AbstractPathEffect
picker
float or callable[[Artist, Event], tuple[bool, dict]]
pickradius
float
rasterized
bool
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
solid_capstyle
CapStyle or {'butt', 'projecting', 'round'}
solid_joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
transform
unknown
url
str
visible
bool
xdata
1D array
ydata
1D array
zorder
float
See also
Add horizontal lines in data coordinates.
Add a horizontal span (rectangle) across the axis.
Add a line with an arbitrary slope.
draw a thick red hline at 'y' = 0 that spans the xrange:
draw a default hline at 'y' = 1 that spans the xrange:
draw a default hline at 'y' = .5 that spans the middle half of the xrange:
Bar Label Demo
Filling the area between lines
Using span_where
axhspan Demo
Plot a confidence ellipse of a two-dimensional dataset
Multiline
Usetex Baseline Test
Cross hair cursor
Transformations Tutorial


Add a horizontal span (rectangle) across the Axes.
The rectangle spans from ymin to ymax vertically, and, by default, the whole x-axis horizontally. The x-span can be set using xmin (default: 0) and xmax (default: 1) which are in axis units; e.g. xmin = 0.5 always refers to the middle of the x-axis regardless of the limits set by set_xlim.
Lower y-coordinate of the span, in data units.
Upper y-coordinate of the span, in data units.
Lower x-coordinate of the span, in x-axis (0-1) units.
Upper x-coordinate of the span, in x-axis (0-1) units.
Horizontal span (rectangle) from (xmin, ymin) to (xmax, ymax).
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
scalar or None
animated
bool
antialiased or aa
bool or None
capstyle
CapStyle or {'butt', 'projecting', 'round'}
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
closed
bool
color
color
edgecolor or ec
color or None
facecolor or fc
color or None
figure
Figure
fill
bool
gid
str
hatch
{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout
bool
joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
label
object
linestyle or ls
{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw
float or None
path_effects
AbstractPathEffect
picker
None or bool or float or callable
rasterized
bool
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
transform
Transform
url
str
visible
bool
xy
(N, 2) array-like
zorder
float
See also
Add a vertical span across the Axes.
axhspan Demo
Transformations Tutorial


Convenience method to get or set some axis properties.
Call signatures:
The axis limits to be set. This can also be achieved using
If a bool, turns axis lines and labels on or off. If a string, possible values are:
Value
Description
'on'
Turn on axis lines and labels. Same as True.
'off'
Turn off axis lines and labels. Same as False.
'equal'
Set equal scaling (i.e., make circles circular) by changing axis limits. This is the same as ax.set_aspect('equal', adjustable='datalim'). Explicit data limits may not be respected in this case.
'scaled'
Set equal scaling (i.e., make circles circular) by changing dimensions of the plot box. This is the same as ax.set_aspect('equal', adjustable='box', anchor='C'). Additionally, further autoscaling will be disabled.
'tight'
Set limits just large enough to show all data, then disable further autoscaling.
'auto'
Automatic scaling (fill plot box with data).
'image'
'scaled' with axis limits equal to data limits.
'square'
Square plot; similar to 'scaled', but initially forcing xmax-xmin == ymax-ymin.
Whether observers are notified of the axis limit change. This option is passed on to set_xlim and set_ylim.
The axis limits.
See also
Clipping images with patches
Basic pie chart
Bar of pie
Hatch style reference
PathPatch object
ggplot style sheet
Parasite Simple2
Simple Axisline4
Axis Direction
axis_direction demo
Axis line styles
mpl_toolkits.axisartist.floating_axes features
Parasite Axes demo
Parasite axis demo
Ticklabel alignment
Ticklabel direction
Simple Axis Direction01
Simple Axis Direction03
Simple Axis Pad
Custom spines with axisartist
Simple Axisline
Simple Axisline3
Packed-bubble chart
TickedStroke patheffect
MRI
MRI With EEG
Basic Usage
Specifying Colors
Text in Matplotlib Plots


Add an infinitely long straight line.
The line can be defined either by two points xy1 and xy2, or by one point xy1 and a slope.
This draws a straight line "on the screen", regardless of the x and y scales, and is thus also suitable for drawing exponential decays in semilog plots, power laws in loglog plots, etc. However, slope should only be used with linear scales; It has no clear meaning for all other scales, and thus the behavior is undefined. Please specify the line using the points xy1, xy2 for non-linear scales.
The transform keyword argument only applies to the points xy1, xy2. The slope (if given) is always in data coordinates. This can be used e.g. with ax.transAxes for drawing grid lines with a fixed slope.
Points for the line to pass through. Either xy2 or slope has to be given.
The slope of the line. Either xy2 or slope has to be given.
Valid kwargs are Line2D properties
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
scalar or None
animated
bool
antialiased or aa
bool
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
color or c
color
dash_capstyle
CapStyle or {'butt', 'projecting', 'round'}
dash_joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
dashes
sequence of floats (on/off ink in points) or (None, None)
data
(2, N) array or two 1D arrays
drawstyle or ds
{'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'
figure
Figure
fillstyle
{'full', 'left', 'right', 'bottom', 'top', 'none'}
gid
str
in_layout
bool
label
object
linestyle or ls
{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw
float
marker
marker style string, Path or MarkerStyle
markeredgecolor or mec
color
markeredgewidth or mew
float
markerfacecolor or mfc
color
markerfacecoloralt or mfcalt
color
markersize or ms
float
markevery
None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool]
path_effects
AbstractPathEffect
picker
float or callable[[Artist, Event], tuple[bool, dict]]
pickradius
float
rasterized
bool
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
solid_capstyle
CapStyle or {'butt', 'projecting', 'round'}
solid_joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
transform
unknown
url
str
visible
bool
xdata
1D array
ydata
1D array
zorder
float
See also
for horizontal lines
for vertical lines
Draw a thick red line passing through (0, 0) and (1, 1):
axhspan Demo
Anscombe's quartet


Add a vertical line across the Axes.
x position in data coordinates of the vertical line.
Should be between 0 and 1, 0 being the bottom of the plot, 1 the top of the plot.
Should be between 0 and 1, 0 being the bottom of the plot, 1 the top of the plot.
Valid keyword arguments are Line2D properties, with the exception of 'transform':
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
scalar or None
animated
bool
antialiased or aa
bool
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
color or c
color
dash_capstyle
CapStyle or {'butt', 'projecting', 'round'}
dash_joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
dashes
sequence of floats (on/off ink in points) or (None, None)
data
(2, N) array or two 1D arrays
drawstyle or ds
{'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'
figure
Figure
fillstyle
{'full', 'left', 'right', 'bottom', 'top', 'none'}
gid
str
in_layout
bool
label
object
linestyle or ls
{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw
float
marker
marker style string, Path or MarkerStyle
markeredgecolor or mec
color
markeredgewidth or mew
float
markerfacecolor or mfc
color
markerfacecoloralt or mfcalt
color
markersize or ms
float
markevery
None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool]
path_effects
AbstractPathEffect
picker
float or callable[[Artist, Event], tuple[bool, dict]]
pickradius
float
rasterized
bool
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
solid_capstyle
CapStyle or {'butt', 'projecting', 'round'}
solid_joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
transform
unknown
url
str
visible
bool
xdata
1D array
ydata
1D array
zorder
float
See also
Add vertical lines in data coordinates.
Add a vertical span (rectangle) across the axis.
Add a line with an arbitrary slope.
draw a thick red vline at x = 0 that spans the yrange:
draw a default vline at x = 1 that spans the yrange:
draw a default vline at x = .5 that spans the middle half of the yrange:
axhspan Demo
Plot a confidence ellipse of a two-dimensional dataset
Usetex Baseline Test
Cross hair cursor
SkewT-logP diagram: using transforms and custom projections
The Lifecycle of a Plot
Transformations Tutorial


Add a vertical span (rectangle) across the Axes.
The rectangle spans from xmin to xmax horizontally, and, by default, the whole y-axis vertically. The y-span can be set using ymin (default: 0) and ymax (default: 1) which are in axis units; e.g. ymin = 0.5 always refers to the middle of the y-axis regardless of the limits set by set_ylim.
Lower x-coordinate of the span, in data units.
Upper x-coordinate of the span, in data units.
Lower y-coordinate of the span, in y-axis units (0-1).
Upper y-coordinate of the span, in y-axis units (0-1).
Vertical span (rectangle) from (xmin, ymin) to (xmax, ymax).
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
scalar or None
animated
bool
antialiased or aa
bool or None
capstyle
CapStyle or {'butt', 'projecting', 'round'}
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
closed
bool
color
color
edgecolor or ec
color or None
facecolor or fc
color or None
figure
Figure
fill
bool
gid
str
hatch
{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout
bool
joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
label
object
linestyle or ls
{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw
float or None
path_effects
AbstractPathEffect
picker
None or bool or float or callable
rasterized
bool
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
transform
Transform
url
str
visible
bool
xy
(N, 2) array-like
zorder
float
See also
Add a horizontal span across the Axes.
Draw a vertical, green, translucent rectangle from x = 1.25 to x = 1.55 that spans the yrange of the Axes.
axhspan Demo
Transformations Tutorial


Make a bar plot.
The bars are positioned at x with the given alignment. Their dimensions are given by height and width. The vertical baseline is bottom (default 0).
Many parameters can take either a single value applying to all bars or a sequence of values, one for each bar.
The x coordinates of the bars. See also align for the alignment of the bars to the coordinates.
The height(s) of the bars.
The width(s) of the bars.
The y coordinate(s) of the bars bases.
Alignment of the bars to the x coordinates:
To align the bars on the right edge pass a negative width and align='edge'.
Container with all the bars and optionally errorbars.
The colors of the bar faces.
The colors of the bar edges.
Width of the bar edge(s). If 0, don't draw edges.
The tick labels of the bars. Default: None (Use default numeric labels.)
If not None, add horizontal / vertical errorbars to the bar tips. The values are +/- sizes relative to the data:
See Different ways of specifying error bars for an example on the usage of xerr and yerr.
The line color of the errorbars.
The length of the error bar caps in points.
Dictionary of kwargs to be passed to the errorbar method. Values of ecolor or capsize defined here take precedence over the independent kwargs.
If True, set the y-axis to be log scale.
If given, all parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception).
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
scalar or None
angle
unknown
animated
bool
antialiased or aa
bool or None
bounds
(left, bottom, width, height)
capstyle
CapStyle or {'butt', 'projecting', 'round'}
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
color
color
edgecolor or ec
color or None
facecolor or fc
color or None
figure
Figure
fill
bool
gid
str
hatch
{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
height
unknown
in_layout
bool
joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
label
object
linestyle or ls
{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw
float or None
path_effects
AbstractPathEffect
picker
None or bool or float or callable
rasterized
bool
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
transform
Transform
url
str
visible
bool
width
unknown
x
unknown
xy
(float, float)
y
unknown
zorder
float
See also
Plot a horizontal bar plot.
Stacked bars can be achieved by passing individual bottom values per bar. See Stacked bar chart.
Bar Label Demo
Stacked bar chart
Grouped bar chart with labels
Hat graph
Bar of pie
Nested pie charts
Bar chart on polar axis
Legend Demo
ggplot style sheet
mpl_toolkits.axisartist.floating_axes features
XKCD
Create 2D bar graphs in different planes
Log Bar
Custom Ticker1
Group barchart with units
Basic Usage
Artist tutorial
Path Tutorial
bar(x, height) / barh(y, width)


Label a bar plot.
Adds labels to bars in the given BarContainer. You may need to adjust the axis limits to fit the labels.
Container with all the bars and optionally errorbars, likely returned from bar or barh.
A list of label texts, that should be displayed. If not given, the label texts will be the data values formatted with fmt.
A format string for the label.
The label type. Possible values:
Distance of label from the end of the bar, in points.
Any remaining keyword arguments are passed through to Axes.annotate.
A list of Text instances for the labels.
Bar Label Demo
Grouped bar chart with labels


Plot a 2D field of barbs.
Call signature:
Where X, Y define the barb locations, U, V define the barb directions, and C optionally sets the color.
All arguments may be 1D or 2D. U, V, C may be masked arrays, but masked X, Y are not supported at present.
Barbs are traditionally used in meteorology as a way to plot the speed and direction of wind observations, but can technically be used to plot any two dimensional vector quantity. As opposed to arrows, which give vector magnitude by the length of the arrow, the barbs give more quantitative information about the vector magnitude by putting slanted lines or a triangle for various increments in magnitude, as show schematically below:
The largest increment is given by a triangle (or "flag"). After those come full lines (barbs). The smallest increment is a half line. There is only, of course, ever at most 1 half line. If the magnitude is small and only needs a single half-line and no full lines or triangles, the half-line is offset from the end of the barb so that it can be easily distinguished from barbs with a single full line. The magnitude for the barb shown above would nominally be 65, using the standard increments of 50, 10, and 5.
See also https://en.wikipedia.org/wiki/Wind_barb.
The x and y coordinates of the barb locations. See pivot for how the barbs are drawn to the x, y positions.
If not given, they will be generated as a uniform integer meshgrid based on the dimensions of U and V.
If X and Y are 1D but U, V are 2D, X, Y are expanded to 2D using X, Y = np.meshgrid(X, Y). In this case len(X) and len(Y) must match the column and row dimensions of U and V.
The x and y components of the barb shaft.
Numeric data that defines the barb colors by colormapping via norm and cmap.
This does not support explicit colors. If you want to set colors directly, use barbcolor instead.
Length of the barb in points; the other parts of the barb are scaled against this.
The part of the arrow that is anchored to the X, Y grid. The barb rotates about this point. This can also be a number, which shifts the start of the barb that many points away from grid point.
The color of all parts of the barb except for the flags. This parameter is analogous to the edgecolor parameter for polygons, which can be used instead. However this parameter will override facecolor.
The color of any flags on the barb. This parameter is analogous to the facecolor parameter for polygons, which can be used instead. However, this parameter will override facecolor. If this is not set (and C has not either) then flagcolor will be set to match barbcolor so that the barb has a uniform color. If C has been set, flagcolor has no effect.
A dictionary of coefficients specifying the ratio of a given feature to the length of the barb. Only those values one wishes to override need to be included. These features include:
Whether the empty barbs (circles) that are drawn should be filled with the flag color. If they are not filled, the center is transparent.
Whether the vector magnitude should be rounded when allocating barb components. If True, the magnitude is rounded to the nearest multiple of the half-barb increment. If False, the magnitude is simply truncated to the next lowest multiple.
A dictionary of increments specifying values to associate with different parts of the barb. Only those values one wishes to override need to be included.
Whether the lines and flags should point opposite to normal. Normal behavior is for the barbs and lines to point right (comes from wind barbs having these features point towards low pressure in the Northern Hemisphere).
A single value is applied to all barbs. Individual barbs can be flipped by passing a bool array of the same size as U and V.
If given, all parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception).
The barbs can further be customized using PolyCollection keyword arguments:
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
array-like or scalar or None
animated
bool
antialiased or aa or antialiaseds
bool or list of bools
array
array-like or None
capstyle
CapStyle or {'butt', 'projecting', 'round'}
clim
(vmin: float, vmax: float)
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
cmap
Colormap or str or None
color
color or list of rgba tuples
edgecolor or ec or edgecolors
color or list of colors or 'face'
facecolor or facecolors or fc
color or list of colors
figure
Figure
gid
str
hatch
{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout
bool
joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
label
object
linestyle or dashes or linestyles or ls
str or tuple or list thereof
linewidth or linewidths or lw
float or list of floats
norm
Normalize or None
offset_transform
Transform
offsets
(N, 2) or (2,) array-like
path_effects
AbstractPathEffect
paths
list of array-like
picker
None or bool or float or callable
pickradius
float
rasterized
bool
sizes
ndarray or None
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
transform
Transform
url
str
urls
list of str or None
verts
list of array-like
verts_and_codes
unknown
visible
bool
zorder
float
Wind Barbs
barbs(X, Y, U, V)


Make a horizontal bar plot.
The bars are positioned at y with the given alignment. Their dimensions are given by width and height. The horizontal baseline is left (default 0).
Many parameters can take either a single value applying to all bars or a sequence of values, one for each bar.
The y coordinates of the bars. See also align for the alignment of the bars to the coordinates.
The width(s) of the bars.
The heights of the bars.
The x coordinates of the left sides of the bars.
Alignment of the base to the y coordinates*:
To align the bars on the top edge pass a negative height and align='edge'.
Container with all the bars and optionally errorbars.
The colors of the bar faces.
The colors of the bar edges.
Width of the bar edge(s). If 0, don't draw edges.
The tick labels of the bars. Default: None (Use default numeric labels.)
If not None, add horizontal / vertical errorbars to the bar tips. The values are +/- sizes relative to the data:
See Different ways of specifying error bars for an example on the usage of xerr and yerr.
The line color of the errorbars.
The length of the error bar caps in points.
Dictionary of kwargs to be passed to the errorbar method. Values of ecolor or capsize defined here take precedence over the independent kwargs.
If True, set the x-axis to be log scale.
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
scalar or None
angle
unknown
animated
bool
antialiased or aa
bool or None
bounds
(left, bottom, width, height)
capstyle
CapStyle or {'butt', 'projecting', 'round'}
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
color
color
edgecolor or ec
color or None
facecolor or fc
color or None
figure
Figure
fill
bool
gid
str
hatch
{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
height
unknown
in_layout
bool
joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
label
object
linestyle or ls
{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw
float or None
path_effects
AbstractPathEffect
picker
None or bool or float or callable
rasterized
bool
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
transform
Transform
url
str
visible
bool
width
unknown
x
unknown
xy
(float, float)
y
unknown
zorder
float
See also
Plot a vertical bar plot.
Stacked bars can be achieved by passing individual left values per bar. See Discrete distribution as horizontal bar chart .
Bar Label Demo
Horizontal bar chart
Producing multiple histograms side by side
The Lifecycle of a Plot


Draw a box and whisker plot.
The box extends from the first quartile (Q1) to the third quartile (Q3) of the data, with a line at the median. The whiskers extend from the box by 1.5x the inter-quartile range (IQR). Flier points are those past the end of the whiskers. See https://en.wikipedia.org/wiki/Box_plot for reference.
The input data. If a 2D array, a boxplot is drawn for each column in x. If a sequence of 1D arrays, a boxplot is drawn for each array in x.
Whether to draw a notched boxplot (True), or a rectangular boxplot (False). The notches represent the confidence interval (CI) around the median. The documentation for bootstrap describes how the locations of the notches are computed by default, but their locations may also be overridden by setting the conf_intervals parameter.
Note
In cases where the values of the CI are less than the lower quartile or greater than the upper quartile, the notches will extend beyond the box, giving it a distinctive "flipped" appearance. This is expected behavior and consistent with other statistical visualization packages.
The default symbol for flier points. An empty string ('') hides the fliers. If None, then the fliers default to 'b+'. More control is provided by the flierprops parameter.
If True, draws vertical boxes. If False, draw horizontal boxes.
The position of the whiskers.
If a float, the lower whisker is at the lowest datum above Q1 - whis*(Q3-Q1), and the upper whisker at the highest datum below Q3 + whis*(Q3-Q1), where Q1 and Q3 are the first and third quartiles. The default value of whis = 1.5 corresponds to Tukey's original definition of boxplots.
If a pair of floats, they indicate the percentiles at which to draw the whiskers (e.g., (5, 95)). In particular, setting this to (0, 100) results in whiskers covering the whole range of the data.
In the edge case where Q1 == Q3, whis is automatically set to (0, 100) (cover the whole range of the data) if autorange is True.
Beyond the whiskers, data are considered outliers and are plotted as individual points.
Specifies whether to bootstrap the confidence intervals around the median for notched boxplots. If bootstrap is None, no bootstrapping is performed, and notches are calculated using a Gaussian-based asymptotic approximation (see McGill, R., Tukey, J.W., and Larsen, W.A., 1978, and Kendall and Stuart, 1967). Otherwise, bootstrap specifies the number of times to bootstrap the median to determine its 95% confidence intervals. Values between 1000 and 10000 are recommended.
A 1D array-like of length len(x). Each entry that is not None forces the value of the median for the corresponding dataset. For entries that are None, the medians are computed by Matplotlib as normal.
A 2D array-like of shape (len(x), 2). Each entry that is not None forces the location of the corresponding notch (which is only drawn if notch is True). For entries that are None, the notches are computed by the method specified by the other parameters (e.g., bootstrap).
The positions of the boxes. The ticks and limits are automatically set to match the positions. Defaults to range(1, N+1) where N is the number of boxes to be drawn.
The widths of the boxes. The default is 0.5, or 0.15*(distance
between extreme positions), if that is smaller.
If False produces boxes with the Line2D artist. Otherwise, boxes are drawn with Patch artists.
Labels for each dataset (one per dataset).
If True, the tick locations and labels will be adjusted to match the boxplot positions.
When True and the data are distributed such that the 25th and 75th percentiles are equal, whis is set to (0, 100) such that the whisker ends are at the minimum and maximum of the data.
If True (and showmeans is True), will try to render the mean as a line spanning the full width of the box according to meanprops (see below). Not recommended if shownotches is also True. Otherwise, means will be shown as points.
The zorder of the boxplot.
A dictionary mapping each component of the boxplot to a list of the Line2D instances created. That dictionary has the following keys (assuming vertical boxplots):
Show the caps on the ends of whiskers.
Show the central box.
Show the outliers beyond the caps.
Show the arithmetic means.
The style of the caps.
The style of the box.
The style of the whiskers.
The style of the fliers.
The style of the median.
The style of the mean.
If given, all parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception).
See also
Draw an estimate of the probability density function.
Box plots with custom fill colors
Boxplots
Boxplot Demo
boxplot(X)


Plot a horizontal sequence of rectangles.
A rectangle is drawn for each element of xranges. All rectangles have the same vertical position and size defined by yrange.
This is a convenience function for instantiating a BrokenBarHCollection, adding it to the Axes and autoscaling the view.
The x-positions and extends of the rectangles. For each tuple (xmin, xwidth) a rectangle is drawn from xmin to xmin + xwidth.
The y-position and extend for all the rectangles.
If given, all parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception).
Each kwarg can be either a single argument applying to all rectangles, e.g.:
or a sequence of arguments over which is cycled, e.g.:
would create interleaving black and blue rectangles.
Supported keywords:
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
array-like or scalar or None
animated
bool
antialiased or aa or antialiaseds
bool or list of bools
array
array-like or None
capstyle
CapStyle or {'butt', 'projecting', 'round'}
clim
(vmin: float, vmax: float)
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
cmap
Colormap or str or None
color
color or list of rgba tuples
edgecolor or ec or edgecolors
color or list of colors or 'face'
facecolor or facecolors or fc
color or list of colors
figure
Figure
gid
str
hatch
{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout
bool
joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
label
object
linestyle or dashes or linestyles or ls
str or tuple or list thereof
linewidth or linewidths or lw
float or list of floats
norm
Normalize or None
offset_transform
Transform
offsets
(N, 2) or (2,) array-like
path_effects
AbstractPathEffect
paths
list of array-like
picker
None or bool or float or callable
pickradius
float
rasterized
bool
sizes
ndarray or None
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
transform
Transform
url
str
urls
list of str or None
verts
list of array-like
verts_and_codes
unknown
visible
bool
zorder
float
Broken Barh


Drawing function for box and whisker plots.
Make a box and whisker plot for each column of x or each vector in sequence x. The box extends from the lower to upper quartile values of the data, with a line at the median. The whiskers extend from the box to show the range of the data. Flier points are those past the end of the whiskers.
A list of dictionaries containing stats for each boxplot. Required keys are:
Optional keys are:
The positions of the boxes. The ticks and limits are automatically set to match the positions.
The widths of the boxes. The default is clip(0.15*(distance between extreme positions), 0.15, 0.5).
If True (default), makes the boxes vertical. If False, makes horizontal boxes.
If False produces boxes with the Line2D artist. If True produces boxes with the Patch artist.
Whether to draw the CI notches, the mean value (both default to False), the caps, the box, and the fliers (all three default to True).
Artist properties for the boxes, whiskers, caps, fliers, medians, and means.
If True (and showmeans is True), will try to render the mean as a line spanning the full width of the box according to meanprops. Not recommended if shownotches is also True. Otherwise, means will be shown as points.
If True, the tick locations and labels will be adjusted to match the boxplot positions.
The zorder of the resulting boxplot.
A dictionary mapping each component of the boxplot to a list of the Line2D instances created. That dictionary has the following keys (assuming vertical boxplots):
(Source code, png, pdf)
(png, pdf)


Return whether this Axes supports any pan/zoom button functionality.


Return whether this Axes supports the zoom box button functionality.


Clear the Axes.
pyplot animation
Data Browser


Label a contour plot.
Adds labels to line contours in given ContourSet.
Line contours to label.
A list of level values, that should be labeled. The list must be a subset of CS.levels. If not given, all levels are labeled.
All other parameters are documented in clabel.
Contour Demo
Contour Label Demo
Contourf Demo
Contouring the solution space of optimizations
Patheffect Demo
TickedStroke patheffect


Plot the coherence between x and y.
Plot the coherence between x and y. Coherence is the normalized cross spectral density:
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing the FFT. This can be different from NFFT, which specifies the number of data points used. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to NFFT
The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
The function applied to each segment before fft-ing, designed to remove the mean or linear trend. Unlike in MATLAB, where the detrend parameter is a vector, in Matplotlib it is a function. The mlab module defines detrend_none, detrend_mean, and detrend_linear, but you can use a custom function as well. You can also use a string to choose one of the functions: 'none' calls detrend_none. 'mean' calls detrend_mean. 'linear' calls detrend_linear.
Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of Hz^-1. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
The number of points of overlap between blocks.
The center frequency of x, which offsets the x extents of the plot to reflect the frequency range used when a signal is acquired and then filtered and downsampled to baseband.
The coherence vector.
The frequencies for the elements in Cxy.
If given, the following parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception):
x, y
Keyword arguments control the Line2D properties:
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
scalar or None
animated
bool
antialiased or aa
bool
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
color or c
color
dash_capstyle
CapStyle or {'butt', 'projecting', 'round'}
dash_joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
dashes
sequence of floats (on/off ink in points) or (None, None)
data
(2, N) array or two 1D arrays
drawstyle or ds
{'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'
figure
Figure
fillstyle
{'full', 'left', 'right', 'bottom', 'top', 'none'}
gid
str
in_layout
bool
label
object
linestyle or ls
{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw
float
marker
marker style string, Path or MarkerStyle
markeredgecolor or mec
color
markeredgewidth or mew
float
markerfacecolor or mfc
color
markerfacecoloralt or mfcalt
color
markersize or ms
float
markevery
None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool]
path_effects
AbstractPathEffect
picker
float or callable[[Artist, Event], tuple[bool, dict]]
pickradius
float
rasterized
bool
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
solid_capstyle
CapStyle or {'butt', 'projecting', 'round'}
solid_joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
transform
unknown
url
str
visible
bool
xdata
1D array
ydata
1D array
zorder
float
Bendat & Piersol -- Random Data: Analysis and Measurement Procedures, John Wiley & Sons (1986)


Test whether the artist contains the mouse event.
Whether any values are within the radius.
An artist-specific dictionary of details of the event context, such as which points are contained in the pick radius. See the individual Artist subclasses for details.


Return whether point (pair of pixel coordinates) is inside the axes patch.


Plot contour lines.
Call signature:
contour and contourf draw contour lines and filled contours, respectively. Except as noted, function signatures and return values are the same for both versions.
The coordinates of the values in Z.
X and Y must both be 2D with the same shape as Z (e.g. created via numpy.meshgrid), or they must both be 1-D such that len(X) == N is the number of columns in Z and len(Y) == M is the number of rows in Z.
X and Y must both be ordered monotonically.
If not given, they are assumed to be integer indices, i.e. X = range(N), Y = range(M).
The height values over which the contour is drawn.
Determines the number and positions of the contour lines / regions.
If an int n, use MaxNLocator, which tries to automatically choose no more than n+1 "nice" contour levels between vmin and vmax.
If array-like, draw contour lines at the specified levels. The values must be in increasing order.
Enable/disable corner masking, which only has an effect if Z is a masked array. If False, any quad touching a masked point is masked out. If True, only the triangular corners of quads nearest those points are always masked out, other triangular corners comprising three unmasked points are contoured as usual.
The colors of the levels, i.e. the lines for contour and the areas for contourf.
The sequence is cycled for the levels in ascending order. If the sequence is shorter than the number of levels, it's repeated.
As a shortcut, single color strings may be used in place of one-element lists, i.e. 'red' instead of ['red'] to color all levels with the same color. This shortcut does only work for color strings, not for other ways of specifying colors.
By default (value None), the colormap specified by cmap will be used.
The alpha blending value, between 0 (transparent) and 1 (opaque).
A Colormap instance or registered colormap name. The colormap maps the level values to colors.
If both colors and cmap are given, an error is raised.
If a colormap is used, the Normalize instance scales the level values to the canonical colormap range [0, 1] for mapping to colors. If not given, the default linear scaling is used.
If not None, either or both of these values will be supplied to the Normalize instance, overriding the default color scaling based on levels.
Determines the orientation and exact position of Z by specifying the position of Z[0, 0]. This is only relevant, if X, Y are not given.
If origin is not None, then extent is interpreted as in imshow: it gives the outer pixel boundaries. In this case, the position of Z[0, 0] is the center of the pixel, not a corner. If origin is None, then (x0, y0) is the position of Z[0, 0], and (x1, y1) is the position of Z[-1, -1].
This argument is ignored if X and Y are specified in the call to contour.
The locator is used to determine the contour levels if they are not given explicitly via levels. Defaults to MaxNLocator.
Determines the contourf-coloring of values that are outside the levels range.
If 'neither', values outside the levels range are not colored. If 'min', 'max' or 'both', color the values below, above or below and above the levels range.
Values below min(levels) and above max(levels) are mapped to the under/over values of the Colormap. Note that most colormaps do not have dedicated colors for these by default, so that the over and under values are the edge values of the colormap. You may want to set these values explicitly using Colormap.set_under and Colormap.set_over.
Note
An existing QuadContourSet does not get notified if properties of its colormap are changed. Therefore, an explicit call QuadContourSet.changed() is needed after modifying the colormap. The explicit call can be left out, if a colorbar is assigned to the QuadContourSet because it internally calls QuadContourSet.changed().
Example:
Override axis units by specifying an instance of a matplotlib.units.ConversionInterface.
Enable antialiasing, overriding the defaults. For filled contours, the default is True. For line contours, it is taken from rcParams["lines.antialiased"] (default: True).
If 0, no subdivision of the domain. Specify a positive integer to divide the domain into subdomains of nchunk by nchunk quads. Chunking reduces the maximum length of polygons generated by the contouring algorithm which reduces the rendering workload passed on to the backend and also requires slightly less RAM. It can however introduce rendering artifacts at chunk boundaries depending on the backend, the antialiased flag and value of alpha.
Only applies to contour.
The line width of the contour lines.
If a number, all levels will be plotted with this linewidth.
If a sequence, the levels in ascending order will be plotted with the linewidths in the order specified.
If None, this falls back to rcParams["lines.linewidth"] (default: 1.5).
Only applies to contour.
If linestyles is None, the default is 'solid' unless the lines are monochrome. In that case, negative contours will take their linestyle from rcParams["contour.negative_linestyle"] (default: 'dashed') setting.
linestyles can also be an iterable of the above strings specifying a set of linestyles to be used. If this iterable is shorter than the number of contour levels it will be repeated as necessary.
Only applies to contourf.
A list of cross hatch patterns to use on the filled areas. If None, no hatching will be added to the contour. Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
If given, all parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception).
contourf fills intervals that are closed at the top; that is, for boundaries z1 and z2, the filled region is:
except for the lowest interval, which is closed on both sides (i.e. it includes the lowest value).
Contour Corner Mask
Contour Demo
Contour Label Demo
Contourf Demo
Contourf Hatching
Contouring the solution space of optimizations
Blend transparency with color in 2D images
Contour plot of irregularly spaced data
Patheffect Demo
TickedStroke patheffect
Demonstrates plotting contour (level) curves in 3D
Demonstrates plotting contour (level) curves in 3D using the extend3d option
Projecting contour profiles onto a graph
contour(X, Y, Z)


Plot filled contours.
Call signature:
contour and contourf draw contour lines and filled contours, respectively. Except as noted, function signatures and return values are the same for both versions.
The coordinates of the values in Z.
X and Y must both be 2D with the same shape as Z (e.g. created via numpy.meshgrid), or they must both be 1-D such that len(X) == N is the number of columns in Z and len(Y) == M is the number of rows in Z.
X and Y must both be ordered monotonically.
If not given, they are assumed to be integer indices, i.e. X = range(N), Y = range(M).
The height values over which the contour is drawn.
Determines the number and positions of the contour lines / regions.
If an int n, use MaxNLocator, which tries to automatically choose no more than n+1 "nice" contour levels between vmin and vmax.
If array-like, draw contour lines at the specified levels. The values must be in increasing order.
Enable/disable corner masking, which only has an effect if Z is a masked array. If False, any quad touching a masked point is masked out. If True, only the triangular corners of quads nearest those points are always masked out, other triangular corners comprising three unmasked points are contoured as usual.
The colors of the levels, i.e. the lines for contour and the areas for contourf.
The sequence is cycled for the levels in ascending order. If the sequence is shorter than the number of levels, it's repeated.
As a shortcut, single color strings may be used in place of one-element lists, i.e. 'red' instead of ['red'] to color all levels with the same color. This shortcut does only work for color strings, not for other ways of specifying colors.
By default (value None), the colormap specified by cmap will be used.
The alpha blending value, between 0 (transparent) and 1 (opaque).
A Colormap instance or registered colormap name. The colormap maps the level values to colors.
If both colors and cmap are given, an error is raised.
If a colormap is used, the Normalize instance scales the level values to the canonical colormap range [0, 1] for mapping to colors. If not given, the default linear scaling is used.
If not None, either or both of these values will be supplied to the Normalize instance, overriding the default color scaling based on levels.
Determines the orientation and exact position of Z by specifying the position of Z[0, 0]. This is only relevant, if X, Y are not given.
If origin is not None, then extent is interpreted as in imshow: it gives the outer pixel boundaries. In this case, the position of Z[0, 0] is the center of the pixel, not a corner. If origin is None, then (x0, y0) is the position of Z[0, 0], and (x1, y1) is the position of Z[-1, -1].
This argument is ignored if X and Y are specified in the call to contour.
The locator is used to determine the contour levels if they are not given explicitly via levels. Defaults to MaxNLocator.
Determines the contourf-coloring of values that are outside the levels range.
If 'neither', values outside the levels range are not colored. If 'min', 'max' or 'both', color the values below, above or below and above the levels range.
Values below min(levels) and above max(levels) are mapped to the under/over values of the Colormap. Note that most colormaps do not have dedicated colors for these by default, so that the over and under values are the edge values of the colormap. You may want to set these values explicitly using Colormap.set_under and Colormap.set_over.
Note
An existing QuadContourSet does not get notified if properties of its colormap are changed. Therefore, an explicit call QuadContourSet.changed() is needed after modifying the colormap. The explicit call can be left out, if a colorbar is assigned to the QuadContourSet because it internally calls QuadContourSet.changed().
Example:
Override axis units by specifying an instance of a matplotlib.units.ConversionInterface.
Enable antialiasing, overriding the defaults. For filled contours, the default is True. For line contours, it is taken from rcParams["lines.antialiased"] (default: True).
If 0, no subdivision of the domain. Specify a positive integer to divide the domain into subdomains of nchunk by nchunk quads. Chunking reduces the maximum length of polygons generated by the contouring algorithm which reduces the rendering workload passed on to the backend and also requires slightly less RAM. It can however introduce rendering artifacts at chunk boundaries depending on the backend, the antialiased flag and value of alpha.
Only applies to contour.
The line width of the contour lines.
If a number, all levels will be plotted with this linewidth.
If a sequence, the levels in ascending order will be plotted with the linewidths in the order specified.
If None, this falls back to rcParams["lines.linewidth"] (default: 1.5).
Only applies to contour.
If linestyles is None, the default is 'solid' unless the lines are monochrome. In that case, negative contours will take their linestyle from rcParams["contour.negative_linestyle"] (default: 'dashed') setting.
linestyles can also be an iterable of the above strings specifying a set of linestyles to be used. If this iterable is shorter than the number of contour levels it will be repeated as necessary.
Only applies to contourf.
A list of cross hatch patterns to use on the filled areas. If None, no hatching will be added to the contour. Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
If given, all parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception).
contourf fills intervals that are closed at the top; that is, for boundaries z1 and z2, the filled region is:
except for the lowest interval, which is closed on both sides (i.e. it includes the lowest value).
Contour Corner Mask
Contourf Demo
Contourf Hatching
Contourf and log color scale
Contour plot of irregularly spaced data
pcolormesh
Frontpage contour example
3D box surface plot
Filled contours
Projecting filled contour onto a graph
contourf(X, Y, Z)


Convert x using the unit type of the xaxis.
If the artist is not in contained in an Axes or if the xaxis does not have units, x itself is returned.


Convert y using the unit type of the yaxis.
If the artist is not in contained in an Axes or if the yaxis does not have units, y itself is returned.