matplotlib.axes.Axes.set_box_aspect   Axes.set_box_aspect(aspect=None)[source]

Set the Axes box aspect, i.e. the ratio of height to width. This defines the aspect of the Axes in figure space and is not to be confused with the data aspect (see set_aspect).  Parameters

aspectfloat or None

Changes the physical dimensions of the Axes, such that the ratio of the Axes height to the Axes width in physical units is equal to aspect. Defining a box aspect will change the adjustable property to 'datalim' (see set_adjustable). None will disable a fixed box aspect so that height and width of the Axes are chosen independently.      See also  matplotlib.axes.Axes.set_aspect

for a description of aspect handling.
  Examples using matplotlib.axes.Axes.set_box_aspect

   Axes box aspect


matplotlib.axes.Axes.set_facecolor   Axes.set_facecolor(color)[source]

Set the facecolor of the Axes.  Parameters

colorcolor

  Examples using matplotlib.axes.Axes.set_facecolor

   Color Demo


matplotlib.axes.Axes.set_frame_on   Axes.set_frame_on(b)[source]

Set whether the Axes rectangle patch is drawn.  Parameters

bbool


matplotlib.axes.Axes.set_navigate   Axes.set_navigate(b)[source]

Set whether the Axes responds to navigation toolbar commands.  Parameters

bbool


matplotlib.axes.Axes.set_navigate_mode   Axes.set_navigate_mode(b)[source]

Set the navigation toolbar button status.  Warning this is not a user-API function.


matplotlib.axes.Axes.set_position   Axes.set_position(pos, which='both')[source]

Set the Axes position. Axes have two position attributes. The 'original' position is the position allocated for the Axes. The 'active' position is the position the Axes is actually drawn at. These positions are usually the same unless a fixed aspect is set to the Axes. See Axes.set_aspect for details.  Parameters

pos[left, bottom, width, height] or Bbox

The new position of the in Figure coordinates.
which{'both', 'active', 'original'}, default: 'both'

Determines which position variables to change.      See also  matplotlib.transforms.Bbox.from_bounds
matplotlib.transforms.Bbox.from_extents

  Examples using matplotlib.axes.Axes.set_position

   Contour Demo


matplotlib.axes.Axes.set_prop_cycle   Axes.set_prop_cycle(*args, **kwargs)[source]

Set the property cycle of the Axes. The property cycle controls the style properties such as color, marker and linestyle of future plot commands. The style properties of data already added to the Axes are not modified. Call signatures: set_prop_cycle(cycler)
set_prop_cycle(label=values[, label2=values2[, ...]])
set_prop_cycle(label, values)
 Form 1 sets given Cycler object. Form 2 creates a Cycler which cycles over one or more properties simultaneously and set it as the property cycle of the Axes. If multiple properties are given, their value lists must have the same length. This is just a shortcut for explicitly creating a cycler and passing it to the function, i.e. it's short for set_prop_cycle(cycler(label=values label2=values2, ...)). Form 3 creates a Cycler for a single property and set it as the property cycle of the Axes. This form exists for compatibility with the original cycler.cycler interface. Its use is discouraged in favor of the kwarg form, i.e. set_prop_cycle(label=values).  Parameters

cyclerCycler

Set the given Cycler. None resets to the cycle defined by the current style.
labelstr

The property key. Must be a valid Artist property. For example, 'color' or 'linestyle'. Aliases are allowed, such as 'c' for 'color' and 'lw' for 'linewidth'.
valuesiterable

Finite-length iterable of the property values. These values are validated and will raise a ValueError if invalid.      See also  matplotlib.rcsetup.cycler

Convenience function for creating validated cyclers for properties.  cycler.cycler

The original function for creating unvalidated cyclers.    Examples Setting the property cycle for a single property: >>> ax.set_prop_cycle(color=['red', 'green', 'blue'])
 Setting the property cycle for simultaneously cycling over multiple properties (e.g. red circle, green plus, blue cross): >>> ax.set_prop_cycle(color=['red', 'green', 'blue'],
...                   marker=['o', '+', 'x'])

  Examples using matplotlib.axes.Axes.set_prop_cycle

   Bachelor's degrees by gender

   Styling with cycler


matplotlib.axes.Axes.set_rasterization_zorder   Axes.set_rasterization_zorder(z)[source]

Set the zorder threshold for rasterization for vector graphics output. All artists with a zorder below the given value will be rasterized if they support rasterization. This setting is ignored for pixel-based output. See also Rasterization for vector graphics.  Parameters

zfloat or None

The zorder below which artists are rasterized. If None rasterization based on zorder is deactivated.
  Examples using matplotlib.axes.Axes.set_rasterization_zorder

   Rasterization for vector graphics


matplotlib.axes.Axes.set_title   Axes.set_title(label, fontdict=None, loc=None, pad=None, *, y=None, **kwargs)[source]

Set a title for the Axes. Set one of the three available Axes titles. The available titles are positioned above the Axes in the center, flush with the left edge, and flush with the right edge.  Parameters

labelstr

Text to use for the title
fontdictdict

A dictionary controlling the appearance of the title text, the default fontdict is: {'fontsize': rcParams['axes.titlesize'],
 'fontweight': rcParams['axes.titleweight'],
 'color': rcParams['axes.titlecolor'],
 'verticalalignment': 'baseline',
 'horizontalalignment': loc}

loc{'center', 'left', 'right'}, default: rcParams["axes.titlelocation"] (default: 'center')

Which title to set.
yfloat, default: rcParams["axes.titley"] (default: None)

Vertical Axes loation for the title (1.0 is the top). If None (the default), y is determined automatically to avoid decorators on the Axes.
padfloat, default: rcParams["axes.titlepad"] (default: 6.0)

The offset of the title from the top of the Axes, in points.    Returns
 Text

The matplotlib text instance representing the title    Other Parameters

**kwargsText properties

Other keyword arguments are text properties, see Text for a list of valid text properties.
  Examples using matplotlib.axes.Axes.set_title

   Bar Label Demo

   Stacked bar chart

   Grouped bar chart with labels

   Horizontal bar chart

   Errorbar subsampling

   EventCollection Demo

   Fill Between and Alpha

   Filling the area between lines

   Fill Betweenx Demo

   Hat graph

   Markevery Demo

   Psd Demo

   Scatter Demo2

   Using span_where

   Stackplots and streamgraphs

   hlines and vlines

   Contour Corner Mask

   Contour Demo

   Contour Label Demo

   Contourf Demo

   Creating annotated heatmaps

   Image antialiasing

   Image Demo

   Image Masked

   Image Nonuniform

   Interpolations for imshow

   Contour plot of irregularly spaced data

   Pcolor Demo

   pcolormesh grids and shading

   pcolormesh

   Streamplot

   Advanced quiver and quiverkey functions

   Tricontour Demo

   Tricontour Smooth Delaunay

   Tricontour Smooth User

   Trigradient Demo

   Tripcolor Demo

   Triplot Demo

   Axes Demo

   Controlling view limits using margins and sticky_edges

   Resizing axes with constrained layout

   Resizing axes with tight layout

   Figure labels: suptitle, supxlabel, supylabel

   Invert Axes

   Secondary Axis

   Figure subfigures

   Creating multiple subplots using plt.subplots

   Box plots with custom fill colors

   Plot a confidence ellipse of a two-dimensional dataset

   Violin plot customization

   Different ways of specifying error bars

   Including upper and lower limits in error bars

   Hexagonal binned plot

   Using histograms to plot a cumulative distribution

   Some features of the histogram (hist) function

   The histogram (hist) function with multiple data sets

   Bar of pie

   Labeling a pie and a donut

   Polar plot

   Using accented text in matplotlib

   Scale invariant angle label

   Date tick labels

   Custom tick formatter for time series

   Labeling ticks using engineering notation

   Using a ttf font file in Matplotlib

   Labelling subplots

   Legend Demo

   Mathtext

   Math fontfamily

   Multiline

   Rendering math equations using TeX

   Title positioning

   Boxplot Demo

   Simple axes labels

   Text Commands

   Color Demo

   Creating a colormap from a list of colors

   Line, Poly and RegularPoly Collection with autoscaling

   Compound path

   Mmh Donuts!!!

   Line Collection

   Bezier Curve

   Bayesian Methods for Hackers style sheet

   Dark background style sheet

   FiveThirtyEight style sheet

   Make Room For Ylabel Using Axesgrid

   Axis Direction

   Anatomy of a figure

   XKCD

   pyplot animation

   Data Browser

   Image Slices Viewer

   Keypress event

   Lasso Demo

   Legend Picking

   Looking Glass

   Path Editor

   Pick Event Demo2

   Poly Editor

   Trifinder Event Demo

   Viewlims

   Cross hair cursor

   Packed-bubble chart

   Pythonic Matplotlib

   Rasterization for vector graphics

   Zorder Demo

   Demo of 3D bar charts

   Lorenz Attractor

   3D wireframe plots in one direction

   Loglog Aspect

   Exploring normalizations

   Scales

   Radar chart (aka spider or star chart)

   Topographic hillshading

   Spine Placement

   Spines

   Dropped spines

   Colorbar Tick Labelling

   Date Precision and Epochs

   Set default x-axis tick labels on the top

   Artist tests

   Group barchart with units

   Evans test

   Interactive Adjustment of Colormap Range

   Annotated Cursor

   Rectangle and ellipse selectors

   Span Selector

   Basic Usage

   Image tutorial

   Artist tutorial

   Styling with cycler

   Constrained Layout Guide

   Tight Layout guide

   Transformations Tutorial

   Specifying Colors

   Colormap Normalization

   Text in Matplotlib Plots


matplotlib.axes.Axes.set_xbound   Axes.set_xbound(lower=None, upper=None)[source]

Set the lower and upper numerical bounds of the x-axis. This method will honor axis inversion regardless of parameter order. It will not change the autoscaling setting (get_autoscalex_on()).  Parameters

lower, upperfloat or None

The lower and upper bounds. If None, the respective axis bound is not modified.      See also  get_xbound

get_xlim, set_xlim

invert_xaxis, xaxis_inverted


matplotlib.axes.Axes.set_xlabel   Axes.set_xlabel(xlabel, fontdict=None, labelpad=None, *, loc=None, **kwargs)[source]

Set the label for the x-axis.  Parameters

xlabelstr

The label text.
labelpadfloat, default: rcParams["axes.labelpad"] (default: 4.0)

Spacing in points from the Axes bounding box including ticks and tick labels. If None, the previous value is left as is.
loc{'left', 'center', 'right'}, default: rcParams["xaxis.labellocation"] (default: 'center')

The label position. This is a high-level alternative for passing parameters x and horizontalalignment.    Other Parameters

**kwargsText properties

Text properties control the appearance of the label.      See also  text

Documents the properties supported by Text.
  Examples using matplotlib.axes.Axes.set_xlabel

   Bar Label Demo

   Horizontal bar chart

   Broken Barh

   CSD Demo

   Fill Between and Alpha

   Filling the area between lines

   Fill Betweenx Demo

   Hatch-filled histograms

   Hat graph

   Psd Demo

   Scatter Demo2

   Stackplots and streamgraphs

   hlines and vlines

   Contourf Demo

   Tricontour Demo

   Tripcolor Demo

   Triplot Demo

   Aligning Labels

   Axes Demo

   Axis Label Position

   Resizing axes with constrained layout

   Resizing axes with tight layout

   Figure labels: suptitle, supxlabel, supylabel

   Invert Axes

   Secondary Axis

   Figure subfigures

   Multiple subplots

   Plots with different scales

   Box plots with custom fill colors

   Boxplots

   Box plot vs. violin plot comparison

   Violin plot customization

   Using histograms to plot a cumulative distribution

   Some features of the histogram (hist) function

   Producing multiple histograms side by side

   Using accented text in matplotlib

   Labeling ticks using engineering notation

   Using a ttf font file in Matplotlib

   Legend Demo

   Mathtext

   Multiline

   Rendering math equations using TeX

   Title positioning

   Simple axes labels

   Text Commands

   Color Demo

   Line, Poly and RegularPoly Collection with autoscaling

   Ellipse Collection

   Dark background style sheet

   Make Room For Ylabel Using Axesgrid

   Parasite Simple

   Parasite Axes demo

   Parasite axis demo

   Ticklabel alignment

   Simple Axis Direction03

   Simple Axisline

   Anatomy of a figure

   XKCD

   Keypress event

   Pythonic Matplotlib

   Plot 2D data on 3D plot

   Create 2D bar graphs in different planes

   3D errorbars

   Lorenz Attractor

   Automatic Text Offsetting

   3D scatterplot

   3D surface with polar coordinates

   Text annotations in 3D

   Log Bar

   MRI With EEG

   Multiple Yaxis With Spines

   Centering labels between ticks

   Pgf Fonts

   Pgf Texsystem

   Slider

   Basic Usage

   Artist tutorial

   Constrained Layout Guide

   Tight Layout guide

   Arranging multiple Axes in a Figure

   Choosing Colormaps in Matplotlib

   Text in Matplotlib Plots


matplotlib.axes.Axes.set_xlim   Axes.set_xlim(left=None, right=None, emit=True, auto=False, *, xmin=None, xmax=None)[source]

Set the x-axis view limits.  Parameters

leftfloat, optional

The left xlim in data coordinates. Passing None leaves the limit unchanged. The left and right xlims may also be passed as the tuple (left, right) as the first positional argument (or as the left keyword argument).
rightfloat, optional

The right xlim in data coordinates. Passing None leaves the limit unchanged.
emitbool, default: True

Whether to notify observers of limit change.
autobool or None, default: False

Whether to turn on autoscaling of the x-axis. True turns on, False turns off, None leaves unchanged.
xmin, xmaxfloat, optional

They are equivalent to left and right respectively, and it is an error to pass both xmin and left or xmax and right.    Returns

left, right(float, float)

The new x-axis limits in data coordinates.      See also  get_xlim

set_xbound, get_xbound

invert_xaxis, xaxis_inverted

  Notes The left value may be greater than the right value, in which case the x-axis values will decrease from left to right. Examples >>> set_xlim(left, right)
>>> set_xlim((left, right))
>>> left, right = set_xlim(left, right)
 One limit may be left unchanged. >>> set_xlim(right=right_lim)
 Limits may be passed in reverse order to flip the direction of the x-axis. For example, suppose x represents the number of years before present. The x-axis limits might be set like the following so 5000 years ago is on the left of the plot and the present is on the right. >>> set_xlim(5000, 0)

  Examples using matplotlib.axes.Axes.set_xlim

   Bar Label Demo

   Broken Barh

   CSD Demo

   EventCollection Demo

   Markevery Demo

   Contouring the solution space of optimizations

   Image Nonuniform

   pcolormesh grids and shading

   Axes box aspect

   Axes Demo

   Figure labels: suptitle, supxlabel, supylabel

   Invert Axes

   Zoom region inset axes

   Boxplots

   Violin plot customization

   Including upper and lower limits in error bars

   Bar of pie

   AnnotationBbox demo

   Using a text as a Path

   Text Rotation Relative To Line

   Annotate Transform

   Mmh Donuts!!!

   Ellipse Demo

   Line Collection

   Inset Locator Demo2

   Parasite Simple2

   axis_direction demo

   Parasite Axes demo

   Parasite axis demo

   Simple Axis Pad

   Anatomy of a figure

   Bachelor's degrees by gender

   XKCD

   Decay

   Rain simulation

   Path Editor

   Poly Editor

   Resampling Data

   Zoom Window

   Frontpage contour example

   Frontpage plot example

   Custom projection

   Building histograms using Rectangles and PolyCollections

   SVG Filter Line

   TickedStroke patheffect

   Plot 2D data on 3D plot

   Draw flat objects in 3D plot

   Text annotations in 3D

   Loglog Aspect

   Scales

   MRI With EEG

   SkewT-logP diagram: using transforms and custom projections

   Multiple Yaxis With Spines

   Custom spine bounds

   Formatting date ticks using ConciseDateFormatter

   Date Demo Convert

   Annotation with units

   Artist tests

   Annotate Text Arrow

   Connect Simple01

   Annotated Cursor

   Cursor

   Span Selector

   Path Tutorial

   Transformations Tutorial

   Specifying Colors

   Choosing Colormaps in Matplotlib


matplotlib.axes.Axes.set_xmargin   Axes.set_xmargin(m)[source]

Set padding of X data limits prior to autoscaling. m times the data interval will be added to each end of that interval before it is used in autoscaling. For example, if your data is in the range [0, 2], a factor of m = 0.1 will result in a range [-0.2, 2.2]. Negative values -0.5 < m < 0 will result in clipping of the data range. I.e. for a data range [0, 2], a factor of m = -0.1 will result in a range [0.2, 1.8].  Parameters

mfloat greater than -0.5

  Examples using matplotlib.axes.Axes.set_xmargin

   Automatically setting tick positions


matplotlib.axes.Axes.set_xscale   Axes.set_xscale(value, **kwargs)[source]

Set the x-axis scale.  Parameters

value{"linear", "log", "symlog", "logit", ...} or ScaleBase

The axis scale type to apply.  **kwargs

Different keyword arguments are accepted, depending on the scale. See the respective class keyword arguments:  matplotlib.scale.LinearScale matplotlib.scale.LogScale matplotlib.scale.SymmetricalLogScale matplotlib.scale.LogitScale matplotlib.scale.FuncScale      Notes By default, Matplotlib supports the above mentioned scales. Additionally, custom scales may be registered using matplotlib.scale.register_scale. These scales can then also be used here.
  Examples using matplotlib.axes.Axes.set_xscale

   Markevery Demo

   Labeling ticks using engineering notation

   Inset Locator Demo

   Loglog Aspect

   Log Demo

   Symlog Demo

   Transformations Tutorial


matplotlib.axes.Axes.set_xticklabels   Axes.set_xticklabels(labels, *, fontdict=None, minor=False, **kwargs)[source]

Set the xaxis' labels with list of string labels.  Warning This method should only be used after fixing the tick positions using Axes.set_xticks. Otherwise, the labels may end up in unexpected positions.   Parameters

labelslist of str

The label texts.
fontdictdict, optional

A dictionary controlling the appearance of the ticklabels. The default fontdict is: {'fontsize': rcParams['axes.titlesize'],
 'fontweight': rcParams['axes.titleweight'],
 'verticalalignment': 'baseline',
 'horizontalalignment': loc}

minorbool, default: False

Whether to set the minor ticklabels rather than the major ones.    Returns
 list of Text

The labels.    Other Parameters

**kwargsText properties.

  Examples using matplotlib.axes.Axes.set_xticklabels

   Managing multiple figures in pyplot

   Zoom region inset axes

   Boxplots

   Rendering math equations using TeX

   XKCD

   Colorbar Tick Labelling

   Constrained Layout Guide


matplotlib.axes.Axes.set_xticks   Axes.set_xticks(ticks, labels=None, *, minor=False, **kwargs)[source]

Set the xaxis' tick locations and optionally labels. If necessary, the view limits of the Axis are expanded so that all given ticks are visible.  Parameters

tickslist of floats

List of tick locations.
labelslist of str, optional

List of tick labels. If not set, the labels show the data value.
minorbool, default: False

If False, set the major ticks; if True, the minor ticks.  **kwargs

Text properties for the labels. These take effect only if you pass labels. In other cases, please use tick_params.     Notes The mandatory expansion of the view limits is an intentional design choice to prevent the surprise of a non-visible tick. If you need other limits, you should set the limits explicitly after setting the ticks.
  Examples using matplotlib.axes.Axes.set_xticks

   Bar Label Demo

   Grouped bar chart with labels

   Hat graph

   Psd Demo

   Creating annotated heatmaps

   Box plot vs. violin plot comparison

   Violin plot customization

   Producing multiple histograms side by side

   Multiline

   Rendering math equations using TeX

   ggplot style sheet

   Scatter Histogram (Locatable Axes)

   Simple Axisline4

   Ticklabel alignment

   Ticklabel direction

   Bachelor's degrees by gender

   Integral as the area under a curve

   Shaded & power normalized rendering

   XKCD

   Rain simulation

   MATPLOTLIB UNCHAINED

   Frontpage 3D example

   Frontpage contour example

   Frontpage histogram example

   Frontpage plot example

   Log Bar

   MRI With EEG

   Custom spine bounds

   Group barchart with units

   The Lifecycle of a Plot


matplotlib.axes.Axes.set_ybound   Axes.set_ybound(lower=None, upper=None)[source]

Set the lower and upper numerical bounds of the y-axis. This method will honor axis inversion regardless of parameter order. It will not change the autoscaling setting (get_autoscaley_on()).  Parameters

lower, upperfloat or None

The lower and upper bounds. If None, the respective axis bound is not modified.      See also  get_ybound

get_ylim, set_ylim

invert_yaxis, yaxis_inverted


matplotlib.axes.Axes.set_ylabel   Axes.set_ylabel(ylabel, fontdict=None, labelpad=None, *, loc=None, **kwargs)[source]

Set the label for the y-axis.  Parameters

ylabelstr

The label text.
labelpadfloat, default: rcParams["axes.labelpad"] (default: 4.0)

Spacing in points from the Axes bounding box including ticks and tick labels. If None, the previous value is left as is.
loc{'bottom', 'center', 'top'}, default: rcParams["yaxis.labellocation"] (default: 'center')

The label position. This is a high-level alternative for passing parameters y and horizontalalignment.    Other Parameters

**kwargsText properties

Text properties control the appearance of the label.      See also  text

Documents the properties supported by Text.
  Examples using matplotlib.axes.Axes.set_ylabel

   Bar Label Demo

   Stacked bar chart

   Grouped bar chart with labels

   CSD Demo

   Fill Between and Alpha

   Hatch-filled histograms

   Hat graph

   Psd Demo

   Scatter Demo2

   Stackplots and streamgraphs

   Contourf Demo

   Creating annotated heatmaps

   Tricontour Demo

   Tripcolor Demo

   Triplot Demo

   Aligning Labels

   Axes Demo

   Axis Label Position

   Resizing axes with constrained layout

   Resizing axes with tight layout

   Figure labels: suptitle, supxlabel, supylabel

   Invert Axes

   Secondary Axis

   Figure subfigures

   Multiple subplots

   Plots with different scales

   Box plots with custom fill colors

   Boxplots

   Box plot vs. violin plot comparison

   Violin plot customization

   Using histograms to plot a cumulative distribution

   Some features of the histogram (hist) function

   Producing multiple histograms side by side

   Using accented text in matplotlib

   Date tick labels

   Legend Demo

   Mathtext

   Multiline

   Rendering math equations using TeX

   Simple axes labels

   Text Commands

   Color Demo

   Line, Poly and RegularPoly Collection with autoscaling

   Ellipse Collection

   Dark background style sheet

   Make Room For Ylabel Using Axesgrid

   Parasite Simple

   Parasite Axes demo

   Parasite axis demo

   Ticklabel alignment

   Simple Axis Direction03

   Simple Axisline

   Anatomy of a figure

   XKCD

   Pythonic Matplotlib

   Plot 2D data on 3D plot

   Create 2D bar graphs in different planes

   3D errorbars

   Lorenz Attractor

   2D and 3D Axes in same Figure

   Automatic Text Offsetting

   3D scatterplot

   3D surface with polar coordinates

   Text annotations in 3D

   Log Bar

   Symlog Demo

   MRI With EEG

   Topographic hillshading

   Multiple Yaxis With Spines

   Basic Usage

   Artist tutorial

   Constrained Layout Guide

   Tight Layout guide

   Arranging multiple Axes in a Figure

   Choosing Colormaps in Matplotlib

   Text in Matplotlib Plots


matplotlib.axes.Axes.set_ylim   Axes.set_ylim(bottom=None, top=None, emit=True, auto=False, *, ymin=None, ymax=None)[source]

Set the y-axis view limits.  Parameters

bottomfloat, optional

The bottom ylim in data coordinates. Passing None leaves the limit unchanged. The bottom and top ylims may also be passed as the tuple (bottom, top) as the first positional argument (or as the bottom keyword argument).
topfloat, optional

The top ylim in data coordinates. Passing None leaves the limit unchanged.
emitbool, default: True

Whether to notify observers of limit change.
autobool or None, default: False

Whether to turn on autoscaling of the y-axis. True turns on, False turns off, None leaves unchanged.
ymin, ymaxfloat, optional

They are equivalent to bottom and top respectively, and it is an error to pass both ymin and bottom or ymax and top.    Returns

bottom, top(float, float)

The new y-axis limits in data coordinates.      See also  get_ylim

set_ybound, get_ybound

invert_yaxis, yaxis_inverted

  Notes The bottom value may be greater than the top value, in which case the y-axis values will decrease from bottom to top. Examples >>> set_ylim(bottom, top)
>>> set_ylim((bottom, top))
>>> bottom, top = set_ylim(bottom, top)
 One limit may be left unchanged. >>> set_ylim(top=top_lim)
 Limits may be passed in reverse order to flip the direction of the y-axis. For example, suppose y represents depth of the ocean in m. The y-axis limits might be set like the following so 5000 m depth is at the bottom of the plot and the surface, 0 m, is at the top. >>> set_ylim(5000, 0)

  Examples using matplotlib.axes.Axes.set_ylim

   Broken Barh

   EventCollection Demo

   Hat graph

   Markevery Demo

   Psd Demo

   Contouring the solution space of optimizations

   Image Nonuniform

   pcolormesh grids and shading

   Axes Demo

   Broken Axis

   Figure labels: suptitle, supxlabel, supylabel

   Zoom region inset axes

   Boxplots

   AnnotationBbox demo

   Using a text as a Path

   Annotate Transform

   Annotating a plot

   Line, Poly and RegularPoly Collection with autoscaling

   Mmh Donuts!!!

   Ellipse Demo

   Line Collection

   Inset Locator Demo2

   Parasite Simple2

   axis_direction demo

   Parasite Axes demo

   Parasite axis demo

   Simple Axis Pad

   Simple Axisline

   Anatomy of a figure

   Bachelor's degrees by gender

   Integral as the area under a curve

   XKCD

   Decay

   Animated histogram

   Rain simulation

   MATPLOTLIB UNCHAINED

   Data Browser

   Path Editor

   Pick Event Demo2

   Poly Editor

   Zoom Window

   Frontpage contour example

   Frontpage plot example

   Custom projection

   Building histograms using Rectangles and PolyCollections

   Pythonic Matplotlib

   SVG Filter Line

   TickedStroke patheffect

   Plot 2D data on 3D plot

   Draw flat objects in 3D plot

   Text annotations in 3D

   Loglog Aspect

   Log Demo

   MRI With EEG

   SkewT-logP diagram: using transforms and custom projections

   Multiple Yaxis With Spines

   Custom spine bounds

   Annotation with units

   Artist tests

   Annotate Text Arrow

   Connect Simple01

   Annotated Cursor

   Cursor

   Span Selector

   Basic Usage

   Path Tutorial

   Transformations Tutorial

   Specifying Colors

   Choosing Colormaps in Matplotlib


matplotlib.axes.Axes.set_ymargin   Axes.set_ymargin(m)[source]

Set padding of Y data limits prior to autoscaling. m times the data interval will be added to each end of that interval before it is used in autoscaling. For example, if your data is in the range [0, 2], a factor of m = 0.1 will result in a range [-0.2, 2.2]. Negative values -0.5 < m < 0 will result in clipping of the data range. I.e. for a data range [0, 2], a factor of m = -0.1 will result in a range [0.2, 1.8].  Parameters

mfloat greater than -0.5


matplotlib.axes.Axes.set_yscale   Axes.set_yscale(value, **kwargs)[source]

Set the y-axis scale.  Parameters

value{"linear", "log", "symlog", "logit", ...} or ScaleBase

The axis scale type to apply.  **kwargs

Different keyword arguments are accepted, depending on the scale. See the respective class keyword arguments:  matplotlib.scale.LinearScale matplotlib.scale.LogScale matplotlib.scale.SymmetricalLogScale matplotlib.scale.LogitScale matplotlib.scale.FuncScale      Notes By default, Matplotlib supports the above mentioned scales. Additionally, custom scales may be registered using matplotlib.scale.register_scale. These scales can then also be used here.
  Examples using matplotlib.axes.Axes.set_yscale

   Markevery Demo

   Artist customization in box plots

   Boxplot drawer function

   Different ways of specifying error bars

   Loglog Aspect

   Log Bar

   Log Demo

   Scales

   Symlog Demo


matplotlib.axes.Axes.set_yticklabels   Axes.set_yticklabels(labels, *, fontdict=None, minor=False, **kwargs)[source]

Set the yaxis' labels with list of string labels.  Warning This method should only be used after fixing the tick positions using Axes.set_yticks. Otherwise, the labels may end up in unexpected positions.   Parameters

labelslist of str

The label texts.
fontdictdict, optional

A dictionary controlling the appearance of the ticklabels. The default fontdict is: {'fontsize': rcParams['axes.titlesize'],
 'fontweight': rcParams['axes.titleweight'],
 'verticalalignment': 'baseline',
 'horizontalalignment': loc}

minorbool, default: False

Whether to set the minor ticklabels rather than the major ones.    Returns
 list of Text

The labels.    Other Parameters

**kwargsText properties.

  Examples using matplotlib.axes.Axes.set_yticklabels

   Zoom region inset axes

   Artist customization in box plots

   Boxplot drawer function

   Violin plot basics

   Rendering math equations using TeX

   Colorbar Tick Labelling

   Constrained Layout Guide


matplotlib.axes.Axes.set_yticks   Axes.set_yticks(ticks, labels=None, *, minor=False, **kwargs)[source]

Set the yaxis' tick locations and optionally labels. If necessary, the view limits of the Axis are expanded so that all given ticks are visible.  Parameters

tickslist of floats

List of tick locations.
labelslist of str, optional

List of tick labels. If not set, the labels show the data value.
minorbool, default: False

If False, set the major ticks; if True, the minor ticks.  **kwargs

Text properties for the labels. These take effect only if you pass labels. In other cases, please use tick_params.     Notes The mandatory expansion of the view limits is an intentional design choice to prevent the surprise of a non-visible tick. If you need other limits, you should set the limits explicitly after setting the ticks.
  Examples using matplotlib.axes.Axes.set_yticks

   Bar Label Demo

   Horizontal bar chart

   Broken Barh

   Psd Demo

   Creating annotated heatmaps

   Rendering math equations using TeX

   Programmatically controlling subplot adjustment

   Make Room For Ylabel Using Axesgrid

   Scatter Histogram (Locatable Axes)

   Ticklabel alignment

   Ticklabel direction

   Bachelor's degrees by gender

   Integral as the area under a curve

   Shaded & power normalized rendering

   XKCD

   Rain simulation

   MATPLOTLIB UNCHAINED

   Frontpage 3D example

   Frontpage contour example

   Frontpage histogram example

   Frontpage plot example

   Create 2D bar graphs in different planes

   MRI With EEG

   SkewT-logP diagram: using transforms and custom projections

   Custom spine bounds


matplotlib.axes.Axes.sharex   Axes.sharex(other)[source]

Share the x-axis with other. This is equivalent to passing sharex=other when constructing the axes, and cannot be used if the x-axis is already being shared with another Axes.


matplotlib.axes.Axes.sharey   Axes.sharey(other)[source]

Share the y-axis with other. This is equivalent to passing sharey=other when constructing the axes, and cannot be used if the y-axis is already being shared with another Axes.


matplotlib.axes.Axes.specgram   Axes.specgram(x, NFFT=None, Fs=None, Fc=None, detrend=None, window=None, noverlap=None, cmap=None, xextent=None, pad_to=None, sides=None, scale_by_freq=None, mode=None, scale=None, vmin=None, vmax=None, *, data=None, **kwargs)[source]

Plot a spectrogram. Compute and plot a spectrogram of data in x. Data are split into NFFT length segments and the spectrum of each section is computed. The windowing function window is applied to each segment, and the amount of overlap of each segment is specified with noverlap. The spectrogram is plotted as a colormap (using imshow).  Parameters

x1-D array or sequence

Array or sequence containing the data.
Fsfloat, default: 2

The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
windowcallable or ndarray, default: window_hanning

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.
sides{'default', 'onesided', 'twosided'}, optional

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.
pad_toint, optional

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
NFFTint, default: 256

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.
detrend{'none', 'mean', 'linear'} or callable, default: 'none'

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.
scale_by_freqbool, default: True

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.
mode{'default', 'psd', 'magnitude', 'angle', 'phase'}

What sort of spectrum to use. Default is 'psd', which takes the power spectral density. 'magnitude' returns the magnitude spectrum. 'angle' returns the phase spectrum without unwrapping. 'phase' returns the phase spectrum with unwrapping.
noverlapint, default: 128

The number of points of overlap between blocks.
scale{'default', 'linear', 'dB'}

The scaling of the values in the spec. 'linear' is no scaling. 'dB' returns the values in dB scale. When mode is 'psd', this is dB power (10 * log10). Otherwise this is dB amplitude (20 * log10). 'default' is 'dB' if mode is 'psd' or 'magnitude' and 'linear' otherwise. This must be 'linear' if mode is 'angle' or 'phase'.
Fcint, default: 0

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.
cmapColormap, default: rcParams["image.cmap"] (default: 'viridis')

xextentNone or (xmin, xmax)

The image extent along the x-axis. The default sets xmin to the left border of the first bin (spectrum column) and xmax to the right border of the last bin. Note that for noverlap>0 the width of the bins is smaller than those of the segments.
dataindexable object, optional

If given, the following parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception): x  **kwargs

Additional keyword arguments are passed on to imshow which makes the specgram image. The origin keyword argument is not supported.    Returns

spectrum2D array

Columns are the periodograms of successive segments.
freqs1-D array

The frequencies corresponding to the rows in spectrum.
t1-D array

The times corresponding to midpoints of segments (i.e., the columns in spectrum).
imAxesImage

The image created by imshow containing the spectrogram.      See also  psd

Differs in the default overlap; in returning the mean of the segment periodograms; in not returning times; and in generating a line plot instead of colormap.  magnitude_spectrum

A single spectrum, similar to having a single segment when mode is 'magnitude'. Plots a line instead of a colormap.  angle_spectrum

A single spectrum, similar to having a single segment when mode is 'angle'. Plots a line instead of a colormap.  phase_spectrum

A single spectrum, similar to having a single segment when mode is 'phase'. Plots a line instead of a colormap.    Notes The parameters detrend and scale_by_freq do only apply when mode is set to 'psd'.
  Examples using matplotlib.axes.Axes.specgram

   Spectrogram Demo


matplotlib.axes.Axes.spy   Axes.spy(Z, precision=0, marker=None, markersize=None, aspect='equal', origin='upper', **kwargs)[source]

Plot the sparsity pattern of a 2D array. This visualizes the non-zero values of the array. Two plotting styles are available: image and marker. Both are available for full arrays, but only the marker style works for scipy.sparse.spmatrix instances. Image style If marker and markersize are None, imshow is used. Any extra remaining keyword arguments are passed to this method. Marker style If Z is a scipy.sparse.spmatrix or marker or markersize are None, a Line2D object will be returned with the value of marker determining the marker type, and any remaining keyword arguments passed to plot.  Parameters

Z(M, N) array-like

The array to be plotted.
precisionfloat or 'present', default: 0

If precision is 0, any non-zero value will be plotted. Otherwise, values of \(|Z| > precision\) will be plotted. For scipy.sparse.spmatrix instances, you can also pass 'present'. In this case any value present in the array will be plotted, even if it is identically zero.
aspect{'equal', 'auto', None} or float, default: 'equal'

The aspect ratio of the Axes. This parameter is particularly relevant for images since it determines whether data pixels are square. This parameter is a shortcut for explicitly calling Axes.set_aspect. See there for further details.  'equal': Ensures an aspect ratio of 1. Pixels will be square. 'auto': The Axes is kept fixed and the aspect is adjusted so that the data fit in the Axes. In general, this will result in non-square pixels.
None: Use rcParams["image.aspect"] (default: 'equal').
origin{'upper', 'lower'}, default: rcParams["image.origin"] (default: 'upper')

Place the [0, 0] index of the array in the upper left or lower left corner of the Axes. The convention 'upper' is typically used for matrices and images.    Returns

AxesImage or Line2D

The return type depends on the plotting style (see above).    Other Parameters
 **kwargs

The supported additional parameters depend on the plotting style. For the image style, you can pass the following additional parameters of imshow:  cmap alpha url any Artist properties (passed on to the AxesImage)  For the marker style, you can pass any Line2D property except for linestyle:
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
  Examples using matplotlib.axes.Axes.spy

   Spy Demos


matplotlib.axes.Axes.stackplot   Axes.stackplot(x, *args, labels=(), colors=None, baseline='zero', data=None, **kwargs)[source]

Draw a stacked area plot.  Parameters

x(N,) array-like

y(M, N) array-like

The data is assumed to be unstacked. Each of the following calls is legal: stackplot(x, y)           # where y has shape (M, N)
stackplot(x, y1, y2, y3)  # where y1, y2, y3, y4 have length N

baseline{'zero', 'sym', 'wiggle', 'weighted_wiggle'}

Method used to calculate the baseline:
'zero': Constant zero baseline, i.e. a simple stacked plot.
'sym': Symmetric around zero and is sometimes called 'ThemeRiver'.
'wiggle': Minimizes the sum of the squared slopes.
'weighted_wiggle': Does the same but weights to account for size of each layer. It is also called 'Streamgraph'-layout. More details can be found at http://leebyron.com/streamgraph/.
labelslist of str, optional

A sequence of labels to assign to each data series. If unspecified, then no labels will be applied to artists.
colorslist of color, optional

A sequence of colors to be cycled through and used to color the stacked areas. The sequence need not be exactly the same length as the number of provided y, in which case the colors will repeat from the beginning. If not specified, the colors from the Axes property cycle will be used.
dataindexable object, optional

If given, all parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception).  **kwargs

All other keyword arguments are passed to Axes.fill_between.    Returns
 list of PolyCollection

A list of PolyCollection instances, one for each element in the stacked area plot.
  Examples using matplotlib.axes.Axes.stackplot

   Stackplots and streamgraphs


matplotlib.axes.Axes.stairs   Axes.stairs(values, edges=None, *, orientation='vertical', baseline=0, fill=False, data=None, **kwargs)[source]

A stepwise constant function as a line with bounding edges or a filled plot.  Parameters

valuesarray-like

The step heights.
edgesarray-like

The edge positions, with len(edges) == len(vals) + 1, between which the curve takes on vals values.
orientation{'vertical', 'horizontal'}, default: 'vertical'

The direction of the steps. Vertical means that values are along the y-axis, and edges are along the x-axis.
baselinefloat, array-like or None, default: 0

The bottom value of the bounding edges or when fill=True, position of lower edge. If fill is True or an array is passed to baseline, a closed path is drawn.
fillbool, default: False

Whether the area under the step curve should be filled.    Returns

StepPatchmatplotlib.patches.StepPatch

  Other Parameters

dataindexable object, optional

If given, all parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception).  **kwargs

StepPatch properties


matplotlib.axes.Axes.stale   propertyAxes.stale

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


matplotlib.axes.Axes.start_pan   Axes.start_pan(x, y, button)[source]

Called when a pan operation has started.  Parameters

x, yfloat

The mouse coordinates in display coords.
buttonMouseButton

The pressed mouse button.     Notes This is intended to be overridden by new projection types.


matplotlib.axes.Axes.stem   Axes.stem(*args, linefmt=None, markerfmt=None, basefmt=None, bottom=0, label=None, use_line_collection=True, orientation='vertical', data=None)[source]

Create a stem plot. A stem plot draws lines perpendicular to a baseline at each location locs from the baseline to heads, and places a marker there. For vertical stem plots (the default), the locs are x positions, and the heads are y values. For horizontal stem plots, the locs are y positions, and the heads are x values. Call signature: stem([locs,] heads, linefmt=None, markerfmt=None, basefmt=None)
 The locs-positions are optional. The formats may be provided either as positional or as keyword-arguments.  Parameters

locsarray-like, default: (0, 1, ..., len(heads) - 1)

For vertical stem plots, the x-positions of the stems. For horizontal stem plots, the y-positions of the stems.
headsarray-like

For vertical stem plots, the y-values of the stem heads. For horizontal stem plots, the x-values of the stem heads.
linefmtstr, optional

A string defining the color and/or linestyle of the vertical lines:
Character Line Style
'-' solid line
'--' dashed line
'-.' dash-dot line
':' dotted line   Default: 'C0-', i.e. solid line with the first color of the color cycle. Note: Markers specified through this parameter (e.g. 'x') will be silently ignored (unless using use_line_collection=False). Instead, markers should be specified using markerfmt.
markerfmtstr, optional

A string defining the color and/or shape of the markers at the stem heads. Default: 'C0o', i.e. filled circles with the first color of the color cycle.
basefmtstr, default: 'C3-' ('C2-' in classic mode)

A format string defining the properties of the baseline.
orientationstr, default: 'vertical'

If 'vertical', will produce a plot with stems oriented vertically, otherwise the stems will be oriented horizontally.
bottomfloat, default: 0

The y/x-position of the baseline (depending on orientation).
labelstr, default: None

The label to use for the stems in legends.
use_line_collectionbool, default: True

If True, store and plot the stem lines as a LineCollection instead of individual lines, which significantly increases performance. If False, defaults to the old behavior of using a list of Line2D objects. This parameter may be deprecated in the future.
dataindexable object, optional

If given, all parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception).    Returns
 StemContainer

The container may be treated like a tuple (markerline, stemlines, baseline)     Notes  See also The MATLAB function stem which inspired this method.
  Examples using matplotlib.axes.Axes.stem

   Legend Demo

   3D stem

   stem(x, y)


matplotlib.axes.Axes.step   Axes.step(x, y, *args, where='pre', data=None, **kwargs)[source]

Make a step plot. Call signatures: step(x, y, [fmt], *, data=None, where='pre', **kwargs)
step(x, y, [fmt], x2, y2, [fmt2], ..., *, where='pre', **kwargs)
 This is just a thin wrapper around plot which changes some formatting options. Most of the concepts and parameters of plot can be used here as well.  Note This method uses a standard plot with a step drawstyle: The x values are the reference positions and steps extend left/right/both directions depending on where. For the common case where you know the values and edges of the steps, use stairs instead.   Parameters

xarray-like

1D sequence of x positions. It is assumed, but not checked, that it is uniformly increasing.
yarray-like

1D sequence of y levels.
fmtstr, optional

A format string, e.g. 'g' for a green line. See plot for a more detailed description. Note: While full format strings are accepted, it is recommended to only specify the color. Line styles are currently ignored (use the keyword argument linestyle instead). Markers are accepted and plotted on the given positions, however, this is a rarely needed feature for step plots.
where{'pre', 'post', 'mid'}, default: 'pre'

Define where the steps should be placed:  'pre': The y value is continued constantly to the left from every x position, i.e. the interval (x[i-1], x[i]] has the value y[i]. 'post': The y value is continued constantly to the right from every x position, i.e. the interval [x[i], x[i+1]) has the value y[i]. 'mid': Steps occur half-way between the x positions.
dataindexable object, optional

An object with labelled data. If given, provide the label names to plot in x and y.  **kwargs

Additional parameters are the same as those for plot.    Returns
 list of Line2D

Objects representing the plotted data.
  Examples using matplotlib.axes.Axes.step

   step(x, y)


matplotlib.axes.Axes.streamplot   Axes.streamplot(x, y, u, v, density=1, linewidth=None, color=None, cmap=None, norm=None, arrowsize=1, arrowstyle='-|>', minlength=0.1, transform=None, zorder=None, start_points=None, maxlength=4.0, integration_direction='both', *, data=None)[source]

Draw streamlines of a vector flow.  Parameters

x, y1D/2D arrays

Evenly spaced strictly increasing arrays to make a grid. If 2D, all rows of x must be equal and all columns of y must be equal; i.e., they must be as if generated by np.meshgrid(x_1d, y_1d).
u, v2D arrays

x and y-velocities. The number of rows and columns must match the length of y and x, respectively.
densityfloat or (float, float)

Controls the closeness of streamlines. When density = 1, the domain is divided into a 30x30 grid. density linearly scales this grid. Each cell in the grid can have, at most, one traversing streamline. For different densities in each direction, use a tuple (density_x, density_y).
linewidthfloat or 2D array

The width of the stream lines. With a 2D array the line width can be varied across the grid. The array must have the same shape as u and v.
colorcolor or 2D array

The streamline color. If given an array, its values are converted to colors using cmap and norm. The array must have the same shape as u and v.
cmapColormap

Colormap used to plot streamlines and arrows. This is only used if color is an array.
normNormalize

Normalize object used to scale luminance data to 0, 1. If None, stretch (min, max) to (0, 1). This is only used if color is an array.
arrowsizefloat

Scaling factor for the arrow size.
arrowstylestr

Arrow style specification. See FancyArrowPatch.
minlengthfloat

Minimum length of streamline in axes coordinates.
start_pointsNx2 array

Coordinates of starting points for the streamlines in data coordinates (the same coordinates as the x and y arrays).
zorderint

The zorder of the stream lines and arrows. Artists with lower zorder values are drawn first.
maxlengthfloat

Maximum length of streamline in axes coordinates.
integration_direction{'forward', 'backward', 'both'}, default: 'both'

Integrate the streamline in forward, backward or both directions.
dataindexable object, optional

If given, the following parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception): x, y, u, v, start_points    Returns
 StreamplotSet

Container object with attributes
lines: LineCollection of streamlines
arrows: PatchCollection containing FancyArrowPatch objects representing the arrows half-way along stream lines.  This container will probably change in the future to allow changes to the colormap, alpha, etc. for both lines and arrows, but these changes should be backward compatible.
  Examples using matplotlib.axes.Axes.streamplot

   Streamplot

   streamplot(X, Y, U, V)


matplotlib.axes.Axes.table   Axes.table(cellText=None, cellColours=None, cellLoc='right', colWidths=None, rowLabels=None, rowColours=None, rowLoc='left', colLabels=None, colColours=None, colLoc='center', loc='bottom', bbox=None, edges='closed', **kwargs)[source]

Add a table to an Axes. At least one of cellText or cellColours must be specified. These parameters must be 2D lists, in which the outer lists define the rows and the inner list define the column values per row. Each row must have the same number of elements. The table can optionally have row and column headers, which are configured using rowLabels, rowColours, rowLoc and colLabels, colColours, colLoc respectively. For finer grained control over tables, use the Table class and add it to the axes with Axes.add_table.  Parameters

cellText2D list of str, optional

The texts to place into the table cells. Note: Line breaks in the strings are currently not accounted for and will result in the text exceeding the cell boundaries.
cellColours2D list of colors, optional

The background colors of the cells.
cellLoc{'left', 'center', 'right'}, default: 'right'

The alignment of the text within the cells.
colWidthslist of float, optional

The column widths in units of the axes. If not given, all columns will have a width of 1 / ncols.
rowLabelslist of str, optional

The text of the row header cells.
rowColourslist of colors, optional

The colors of the row header cells.
rowLoc{'left', 'center', 'right'}, default: 'left'

The text alignment of the row header cells.
colLabelslist of str, optional

The text of the column header cells.
colColourslist of colors, optional

The colors of the column header cells.
colLoc{'left', 'center', 'right'}, default: 'left'

The text alignment of the column header cells.
locstr, optional

The position of the cell with respect to ax. This must be one of the codes.
bboxBbox, optional

A bounding box to draw the table into. If this is not None, this overrides loc.
edgessubstring of 'BRTL' or {'open', 'closed', 'horizontal', 'vertical'}

The cell edges to be drawn with a line. See also visible_edges.    Returns
 Table

The created table.    Other Parameters
 **kwargs

Table 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
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
figure Figure
fontsize float
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


matplotlib.axes.Axes.text   Axes.text(x, y, s, fontdict=None, **kwargs)[source]

Add text to the Axes. Add the text s to the Axes at location x, y in data coordinates.  Parameters

x, yfloat

The position to place the text. By default, this is in data coordinates. The coordinate system can be changed using the transform parameter.
sstr

The text.
fontdictdict, default: None

A dictionary to override the default text properties. If fontdict is None, the defaults are determined by rcParams.    Returns
 Text

The created Text instance.    Other Parameters

**kwargsText properties.

Other miscellaneous text parameters.
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
backgroundcolor color
bbox dict with properties for patches.FancyBboxPatch
clip_box unknown
clip_on unknown
clip_path unknown
color or c color
figure Figure
fontfamily or family {FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'}
fontproperties or font or font_properties font_manager.FontProperties or str or pathlib.Path
fontsize or size float or {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}
fontstretch or stretch {a numeric value in range 0-1000, 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'}
fontstyle or style {'normal', 'italic', 'oblique'}
fontvariant or variant {'normal', 'small-caps'}
fontweight or weight {a numeric value in range 0-1000, 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'}
gid str
horizontalalignment or ha {'center', 'right', 'left'}
in_layout bool
label object
linespacing float (multiple of font size)
math_fontfamily str
multialignment or ma {'left', 'right', 'center'}
parse_math bool
path_effects AbstractPathEffect
picker None or bool or float or callable
position (float, float)
rasterized bool
rotation float or {'vertical', 'horizontal'}
rotation_mode {None, 'default', 'anchor'}
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
text object
transform Transform
transform_rotates_text bool
url str
usetex bool or None
verticalalignment or va {'center', 'top', 'bottom', 'baseline', 'center_baseline'}
visible bool
wrap bool
x float
y float
zorder float       Examples Individual keyword arguments can be used to override any given parameter: >>> text(x, y, s, fontsize=12)
 The default transform specifies that text is in data coords, alternatively, you can specify text in axis coords ((0, 0) is lower-left and (1, 1) is upper-right). The example below places text in the center of the Axes: >>> text(0.5, 0.5, 'matplotlib', horizontalalignment='center',
...      verticalalignment='center', transform=ax.transAxes)
 You can put a rectangular box around the text instance (e.g., to set a background color) by using the keyword bbox. bbox is a dictionary of Rectangle properties. For example: >>> text(x, y, s, bbox=dict(facecolor='red', alpha=0.5))

  Examples using matplotlib.axes.Axes.text

   Marker reference

   BboxImage Demo

   Creating annotated heatmaps

   Boxplots

   Bar of pie

   Using accented text in matplotlib

   Arrow Demo

   Annotation arrow style reference

   Labelling subplots

   Mathtext

   Math fontfamily

   Multiline

   Placing text boxes

   Rendering math equations using TeX

   Precise text layout

   Text Rotation Relative To Line

   Usetex Baseline Test

   Text watermark

   Text Commands

   Drawing fancy boxes

   Hatch style reference

   Anatomy of a figure

   Bachelor's degrees by gender

   Integral as the area under a curve

   Shaded & power normalized rendering

   The double pendulum problem

   MATPLOTLIB UNCHAINED

   Data Browser

   Pick Event Demo2

   Cross hair cursor

   Packed-bubble chart

   Rasterization for vector graphics

   Text annotations in 3D

   Anscombe's quartet

   Annotate Explain

   Annotate Text Arrow

   Connection styles for annotations

   Custom box styles

   Pgf Fonts

   Pgf Texsystem

   Simple Annotate01

   Mouse Cursor

   Basic Usage

   The Lifecycle of a Plot

   Artist tutorial

   Arranging multiple Axes in a Figure

   Path Tutorial

   Transformations Tutorial

   Specifying Colors

   Choosing Colormaps in Matplotlib

   Text in Matplotlib Plots

   Text properties and layout


matplotlib.axes.Axes.tick_params   Axes.tick_params(axis='both', **kwargs)[source]

Change the appearance of ticks, tick labels, and gridlines. Tick properties that are not explicitly set using the keyword arguments remain unchanged unless reset is True.  Parameters

axis{'x', 'y', 'both'}, default: 'both'

The axis to which the parameters are applied.
which{'major', 'minor', 'both'}, default: 'major'

The group of ticks to which the parameters are applied.
resetbool, default: False

Whether to reset the ticks to defaults before updating them.    Other Parameters

direction{'in', 'out', 'inout'}

Puts ticks inside the axes, outside the axes, or both.
lengthfloat

Tick length in points.
widthfloat

Tick width in points.
colorcolor

Tick color.
padfloat

Distance in points between tick and label.
labelsizefloat or str

Tick label font size in points or as a string (e.g., 'large').
labelcolorcolor

Tick label color.
colorscolor

Tick color and label color.
zorderfloat

Tick and label zorder.
bottom, top, left, rightbool

Whether to draw the respective ticks.
labelbottom, labeltop, labelleft, labelrightbool

Whether to draw the respective tick labels.
labelrotationfloat

Tick label rotation
grid_colorcolor

Gridline color.
grid_alphafloat

Transparency of gridlines: 0 (transparent) to 1 (opaque).
grid_linewidthfloat

Width of gridlines in points.
grid_linestylestr

Any valid Line2D line style spec.     Examples ax.tick_params(direction='out', length=6, width=2, colors='r',
               grid_color='r', grid_alpha=0.5)
 This will make all major ticks be red, pointing out of the box, and with dimensions 6 points by 2 points. Tick labels will also be red. Gridlines will be red and translucent.
  Examples using matplotlib.axes.Axes.tick_params

   Scatter plot with histograms

   Creating annotated heatmaps

   Axes Props

   Broken Axis

   Plots with different scales

   Polar Legend

   Color Demo

   Inset Locator Demo

   Inset Locator Demo2

   Make Room For Ylabel Using Axesgrid

   Simple Axes Divider 3

   Anatomy of a figure

   Bachelor's degrees by gender

   Anscombe's quartet

   Multiple Yaxis With Spines

   Major and minor ticks

   Text in Matplotlib Plots


matplotlib.axes.Axes.ticklabel_format   Axes.ticklabel_format(*, axis='both', style='', scilimits=None, useOffset=None, useLocale=None, useMathText=None)[source]

Configure the ScalarFormatter used by default for linear axes. If a parameter is not set, the corresponding property of the formatter is left unchanged.  Parameters

axis{'x', 'y', 'both'}, default: 'both'

The axis to configure. Only major ticks are affected.
style{'sci', 'scientific', 'plain'}

Whether to use scientific notation. The formatter default is to use scientific notation.
scilimitspair of ints (m, n)

Scientific notation is used only for numbers outside the range 10m to 10n (and only if the formatter is configured to use scientific notation at all). Use (0, 0) to include all numbers. Use (m, m) where m != 0 to fix the order of magnitude to 10m. The formatter default is rcParams["axes.formatter.limits"] (default: [-5, 6]).
useOffsetbool or float

If True, the offset is calculated as needed. If False, no offset is used. If a numeric value, it sets the offset. The formatter default is rcParams["axes.formatter.useoffset"] (default: True).
useLocalebool

Whether to format the number using the current locale or using the C (English) locale. This affects e.g. the decimal separator. The formatter default is rcParams["axes.formatter.use_locale"] (default: False).
useMathTextbool

Render the offset and scientific notation in mathtext. The formatter default is rcParams["axes.formatter.use_mathtext"] (default: False).    Raises
 AttributeError

If the current formatter is not a ScalarFormatter.
  Examples using matplotlib.axes.Axes.ticklabel_format

   The default tick formatter


matplotlib.axes.Axes.tricontour   Axes.tricontour(*args, **kwargs)[source]

Draw contour lines on an unstructured triangular grid. The triangulation can be specified in one of two ways; either tricontour(triangulation, ...)
 where triangulation is a Triangulation object, or tricontour(x, y, ...)
tricontour(x, y, triangles, ...)
tricontour(x, y, triangles=triangles, ...)
tricontour(x, y, mask=mask, ...)
tricontour(x, y, triangles, mask=mask, ...)
 in which case a Triangulation object will be created. See that class' docstring for an explanation of these cases. The remaining arguments may be: tricontour(..., Z)
 where Z is the array of values to contour, one per point in the triangulation. The level values are chosen automatically. tricontour(..., Z, levels)
 contour up to levels+1 automatically chosen contour levels (levels intervals). tricontour(..., Z, levels)
 draw contour lines at the values specified in sequence levels, which must be in increasing order. tricontour(Z, **kwargs)
 Use keyword arguments to control colors, linewidth, origin, cmap ... see below for more details.  Parameters

triangulationTriangulation, optional

The unstructured triangular grid. If specified, then x, y, triangles, and mask are not accepted.
x, yarray-like, optional

The coordinates of the values in Z.
triangles(ntri, 3) array-like of int, optional

For each triangle, the indices of the three points that make up the triangle, ordered in an anticlockwise manner. If not specified, the Delaunay triangulation is calculated.
mask(ntri,) array-like of bool, optional

Which triangles are masked out.
Z2D array-like

The height values over which the contour is drawn.
levelsint or array-like, optional

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.    Returns
 TriContourSet
  Other Parameters

colorscolor string or sequence of colors, optional

The colors of the levels, i.e., the contour lines. 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.
alphafloat, default: 1

The alpha blending value, between 0 (transparent) and 1 (opaque).
cmapstr or Colormap, default: rcParams["image.cmap"] (default: 'viridis')

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.
normNormalize, optional

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.
vmin, vmaxfloat, optional

If not None, either or both of these values will be supplied to the Normalize instance, overriding the default color scaling based on levels.
origin{None, 'upper', 'lower', 'image'}, default: None

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.
None: Z[0, 0] is at X=0, Y=0 in the lower left corner. 'lower': Z[0, 0] is at X=0.5, Y=0.5 in the lower left corner. 'upper': Z[0, 0] is at X=N+0.5, Y=0.5 in the upper left corner. 'image': Use the value from rcParams["image.origin"] (default: 'upper').
extent(x0, x1, y0, y1), optional

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.
locatorticker.Locator subclass, optional

The locator is used to determine the contour levels if they are not given explicitly via levels. Defaults to MaxNLocator.
extend{'neither', 'both', 'min', 'max'}, default: 'neither'

Determines the tricontour-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 TriContourSet does not get notified if properties of its colormap are changed. Therefore, an explicit call to ContourSet.changed() is needed after modifying the colormap. The explicit call can be left out, if a colorbar is assigned to the TriContourSet because it internally calls ContourSet.changed().
xunits, yunitsregistered units, optional

Override axis units by specifying an instance of a matplotlib.units.ConversionInterface.
antialiasedbool, optional

Enable antialiasing, overriding the defaults. For filled contours, the default is True. For line contours, it is taken from rcParams["lines.antialiased"] (default: True).
linewidthsfloat or array-like, default: rcParams["contour.linewidth"] (default: None)

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).
linestyles{None, 'solid', 'dashed', 'dashdot', 'dotted'}, optional

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.
  Examples using matplotlib.axes.Axes.tricontour

   Contour plot of irregularly spaced data

   Tricontour Demo

   Tricontour Smooth Delaunay

   Tricontour Smooth User

   Trigradient Demo

   Triangular 3D contour plot

   tricontour(x, y, z)


matplotlib.axes.Axes.tricontourf   Axes.tricontourf(*args, **kwargs)[source]

Draw contour regions on an unstructured triangular grid. The triangulation can be specified in one of two ways; either tricontourf(triangulation, ...)
 where triangulation is a Triangulation object, or tricontourf(x, y, ...)
tricontourf(x, y, triangles, ...)
tricontourf(x, y, triangles=triangles, ...)
tricontourf(x, y, mask=mask, ...)
tricontourf(x, y, triangles, mask=mask, ...)
 in which case a Triangulation object will be created. See that class' docstring for an explanation of these cases. The remaining arguments may be: tricontourf(..., Z)
 where Z is the array of values to contour, one per point in the triangulation. The level values are chosen automatically. tricontourf(..., Z, levels)
 contour up to levels+1 automatically chosen contour levels (levels intervals). tricontourf(..., Z, levels)
 draw contour regions at the values specified in sequence levels, which must be in increasing order. tricontourf(Z, **kwargs)
 Use keyword arguments to control colors, linewidth, origin, cmap ... see below for more details.  Parameters

triangulationTriangulation, optional

The unstructured triangular grid. If specified, then x, y, triangles, and mask are not accepted.
x, yarray-like, optional

The coordinates of the values in Z.
triangles(ntri, 3) array-like of int, optional

For each triangle, the indices of the three points that make up the triangle, ordered in an anticlockwise manner. If not specified, the Delaunay triangulation is calculated.
mask(ntri,) array-like of bool, optional

Which triangles are masked out.
Z2D array-like

The height values over which the contour is drawn.
levelsint or array-like, optional

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.    Returns
 TriContourSet
  Other Parameters

colorscolor string or sequence of colors, optional

The colors of the levels, i.e., the contour regions. 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.
alphafloat, default: 1

The alpha blending value, between 0 (transparent) and 1 (opaque).
cmapstr or Colormap, default: rcParams["image.cmap"] (default: 'viridis')

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.
normNormalize, optional

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.
vmin, vmaxfloat, optional

If not None, either or both of these values will be supplied to the Normalize instance, overriding the default color scaling based on levels.
origin{None, 'upper', 'lower', 'image'}, default: None

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.
None: Z[0, 0] is at X=0, Y=0 in the lower left corner. 'lower': Z[0, 0] is at X=0.5, Y=0.5 in the lower left corner. 'upper': Z[0, 0] is at X=N+0.5, Y=0.5 in the upper left corner. 'image': Use the value from rcParams["image.origin"] (default: 'upper').
extent(x0, x1, y0, y1), optional

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.
locatorticker.Locator subclass, optional

The locator is used to determine the contour levels if they are not given explicitly via levels. Defaults to MaxNLocator.
extend{'neither', 'both', 'min', 'max'}, default: 'neither'

Determines the tricontourf-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 TriContourSet does not get notified if properties of its colormap are changed. Therefore, an explicit call to ContourSet.changed() is needed after modifying the colormap. The explicit call can be left out, if a colorbar is assigned to the TriContourSet because it internally calls ContourSet.changed().
xunits, yunitsregistered units, optional

Override axis units by specifying an instance of a matplotlib.units.ConversionInterface.
antialiasedbool, optional

Enable antialiasing, overriding the defaults. For filled contours, the default is True. For line contours, it is taken from rcParams["lines.antialiased"] (default: True).
hatcheslist[str], optional

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.     Notes tricontourf fills intervals that are closed at the top; that is, for boundaries z1 and z2, the filled region is: z1 < Z <= z2
 except for the lowest interval, which is closed on both sides (i.e. it includes the lowest value).
  Examples using matplotlib.axes.Axes.tricontourf

   Contour plot of irregularly spaced data

   Tricontour Demo

   Tricontour Smooth User

   Triangular 3D filled contour plot

   tricontourf(x, y, z)


matplotlib.axes.Axes.tripcolor   Axes.tripcolor(*args, alpha=1.0, norm=None, cmap=None, vmin=None, vmax=None, shading='flat', facecolors=None, **kwargs)[source]

Create a pseudocolor plot of an unstructured triangular grid. The triangulation can be specified in one of two ways; either: tripcolor(triangulation, ...)
 where triangulation is a Triangulation object, or tripcolor(x, y, ...)
tripcolor(x, y, triangles, ...)
tripcolor(x, y, triangles=triangles, ...)
tripcolor(x, y, mask=mask, ...)
tripcolor(x, y, triangles, mask=mask, ...)
 in which case a Triangulation object will be created. See Triangulation for a explanation of these possibilities. The next argument must be C, the array of color values, either one per point in the triangulation if color values are defined at points, or one per triangle in the triangulation if color values are defined at triangles. If there are the same number of points and triangles in the triangulation it is assumed that color values are defined at points; to force the use of color values at triangles use the kwarg facecolors=C instead of just C. shading may be 'flat' (the default) or 'gouraud'. If shading is 'flat' and C values are defined at points, the color values used for each triangle are from the mean C of the triangle's three points. If shading is 'gouraud' then color values must be defined at points. The remaining kwargs are the same as for pcolor.
  Examples using matplotlib.axes.Axes.tripcolor

   Tripcolor Demo

   tripcolor(x, y, z)


matplotlib.axes.Axes.triplot   Axes.triplot(*args, **kwargs)[source]

Draw a unstructured triangular grid as lines and/or markers. The triangulation to plot can be specified in one of two ways; either: triplot(triangulation, ...)
 where triangulation is a Triangulation object, or triplot(x, y, ...)
triplot(x, y, triangles, ...)
triplot(x, y, triangles=triangles, ...)
triplot(x, y, mask=mask, ...)
triplot(x, y, triangles, mask=mask, ...)
 in which case a Triangulation object will be created. See Triangulation for a explanation of these possibilities. The remaining args and kwargs are the same as for plot.  Returns

linesLine2D

The drawn triangles edges.
markersLine2D

The drawn marker nodes.
  Examples using matplotlib.axes.Axes.triplot

   Tricontour Smooth Delaunay

   Tricontour Smooth User

   Trigradient Demo

   Triplot Demo

   Trifinder Event Demo

   triplot(x, y)


matplotlib.axes.Axes.twinx   Axes.twinx()[source]

Create a twin Axes sharing the xaxis. Create a new Axes with an invisible x-axis and an independent y-axis positioned opposite to the original one (i.e. at right). The x-axis autoscale setting will be inherited from the original Axes. To ensure that the tick marks of both y-axes align, see LinearLocator.  Returns
 Axes

The newly created Axes instance     Notes For those who are 'picking' artists while using twinx, pick events are only called for the artists in the top-most Axes.
  Examples using matplotlib.axes.Axes.twinx

   Axes box aspect

   Plots with different scales

   Parasite Simple

   Parasite axis demo

   Multiple Yaxis With Spines

   Basic Usage


matplotlib.axes.Axes.twiny   Axes.twiny()[source]

Create a twin Axes sharing the yaxis. Create a new Axes with an invisible y-axis and an independent x-axis positioned opposite to the original one (i.e. at top). The y-axis autoscale setting will be inherited from the original Axes. To ensure that the tick marks of both x-axes align, see LinearLocator.  Returns
 Axes

The newly created Axes instance     Notes For those who are 'picking' artists while using twiny, pick events are only called for the artists in the top-most Axes.


matplotlib.axes.Axes.update_datalim   Axes.update_datalim(xys, updatex=True, updatey=True)[source]

Extend the dataLim Bbox to include the given points. If no data is set currently, the Bbox will ignore its limits and set the bound to be the bounds of the xydata (xys). Otherwise, it will compute the bounds of the union of its current data and the data in xys.  Parameters

xys2D array-like

The points to include in the data limits Bbox. This can be either a list of (x, y) tuples or a Nx2 array.
updatex, updateybool, default: True

Whether to update the x/y limits.


matplotlib.axes.Axes.use_sticky_edges   propertyAxes.use_sticky_edges

When autoscaling, whether to obey all Artist.sticky_edges. Default is True. Setting this to False ensures that the specified margins will be applied, even if the plot includes an image, for example, which would otherwise force a view limit to coincide with its data limit. The changing this property does not change the plot until autoscale or autoscale_view is called.


matplotlib.axes.Axes.violin   Axes.violin(vpstats, positions=None, vert=True, widths=0.5, showmeans=False, showextrema=True, showmedians=False)[source]

Drawing function for violin plots. Draw a violin plot for each column of vpstats. Each filled area extends to represent the entire data range, with optional lines at the mean, the median, the minimum, the maximum, and the quantiles values.  Parameters

vpstatslist of dicts

A list of dictionaries containing stats for each violin plot. Required keys are:
coords: A list of scalars containing the coordinates that the violin's kernel density estimate were evaluated at.
vals: A list of scalars containing the values of the kernel density estimate at each of the coordinates given in coords.
mean: The mean value for this violin's dataset.
median: The median value for this violin's dataset.
min: The minimum value for this violin's dataset.
max: The maximum value for this violin's dataset.  Optional keys are:
quantiles: A list of scalars containing the quantile values for this violin's dataset.
positionsarray-like, default: [1, 2, ..., n]

The positions of the violins. The ticks and limits are automatically set to match the positions.
vertbool, default: True.

If true, plots the violins vertically. Otherwise, plots the violins horizontally.
widthsarray-like, default: 0.5

Either a scalar or a vector that sets the maximal width of each violin. The default is 0.5, which uses about half of the available horizontal space.
showmeansbool, default: False

If true, will toggle rendering of the means.
showextremabool, default: True

If true, will toggle rendering of the extrema.
showmediansbool, default: False

If true, will toggle rendering of the medians.    Returns
 dict

A dictionary mapping each component of the violinplot to a list of the corresponding collection instances created. The dictionary has the following keys:
bodies: A list of the PolyCollection instances containing the filled area of each violin.
cmeans: A LineCollection instance that marks the mean values of each of the violin's distribution.
cmins: A LineCollection instance that marks the bottom of each violin's distribution.
cmaxes: A LineCollection instance that marks the top of each violin's distribution.
cbars: A LineCollection instance that marks the centers of each violin's distribution.
cmedians: A LineCollection instance that marks the median values of each of the violin's distribution.
cquantiles: A LineCollection instance created to identify the quantiles values of each of the violin's distribution.


matplotlib.axes.Axes.violinplot   Axes.violinplot(dataset, positions=None, vert=True, widths=0.5, showmeans=False, showextrema=True, showmedians=False, quantiles=None, points=100, bw_method=None, *, data=None)[source]

Make a violin plot. Make a violin plot for each column of dataset or each vector in sequence dataset. Each filled area extends to represent the entire data range, with optional lines at the mean, the median, the minimum, the maximum, and user-specified quantiles.  Parameters

datasetArray or a sequence of vectors.

The input data.
positionsarray-like, default: [1, 2, ..., n]

The positions of the violins. The ticks and limits are automatically set to match the positions.
vertbool, default: True.

If true, creates a vertical violin plot. Otherwise, creates a horizontal violin plot.
widthsarray-like, default: 0.5

Either a scalar or a vector that sets the maximal width of each violin. The default is 0.5, which uses about half of the available horizontal space.
showmeansbool, default: False

If True, will toggle rendering of the means.
showextremabool, default: True

If True, will toggle rendering of the extrema.
showmediansbool, default: False

If True, will toggle rendering of the medians.
quantilesarray-like, default: None

If not None, set a list of floats in interval [0, 1] for each violin, which stands for the quantiles that will be rendered for that violin.
pointsint, default: 100

Defines the number of points to evaluate each of the gaussian kernel density estimations at.
bw_methodstr, scalar or callable, optional

The method used to calculate the estimator bandwidth. This can be 'scott', 'silverman', a scalar constant or a callable. If a scalar, this will be used directly as kde.factor. If a callable, it should take a GaussianKDE instance as its only parameter and return a scalar. If None (default), 'scott' is used.
dataindexable object, optional

If given, the following parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception): dataset    Returns
 dict

A dictionary mapping each component of the violinplot to a list of the corresponding collection instances created. The dictionary has the following keys:
bodies: A list of the PolyCollection instances containing the filled area of each violin.
cmeans: A LineCollection instance that marks the mean values of each of the violin's distribution.
cmins: A LineCollection instance that marks the bottom of each violin's distribution.
cmaxes: A LineCollection instance that marks the top of each violin's distribution.
cbars: A LineCollection instance that marks the centers of each violin's distribution.
cmedians: A LineCollection instance that marks the median values of each of the violin's distribution.
cquantiles: A LineCollection instance created to identify the quantile values of each of the violin's distribution.
  Examples using matplotlib.axes.Axes.violinplot

   Violin plot customization

   violinplot(D)


matplotlib.axes.Axes.vlines   Axes.vlines(x, ymin, ymax, colors=None, linestyles='solid', label='', *, data=None, **kwargs)[source]

Plot vertical lines at each x from ymin to ymax.  Parameters

xfloat or array-like

x-indexes where to plot the lines.
ymin, ymaxfloat or array-like

Respective beginning and end of each line. If scalars are provided, all lines will have same length.
colorslist of colors, default: rcParams["lines.color"] (default: 'C0')

linestyles{'solid', 'dashed', 'dashdot', 'dotted'}, optional

labelstr, default: ''

  Returns
 LineCollection
  Other Parameters

dataindexable object, optional

If given, the following parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception): x, ymin, ymax, colors
**kwargsLineCollection properties.

    See also  hlines

horizontal lines  axvline

vertical line across the Axes
  Examples using matplotlib.axes.Axes.vlines

   Creating a timeline with lines, dates, and text

   hlines and vlines

   Violin plot customization


matplotlib.axes.Axes.xaxis_date   Axes.xaxis_date(tz=None)[source]

Set up axis ticks and labels to treat data along the xaxis as dates.  Parameters

tzstr or datetime.tzinfo, default: rcParams["timezone"] (default: 'UTC')

The timezone used to create date labels.


matplotlib.axes.Axes.xaxis_inverted   Axes.xaxis_inverted()[source]

Return whether the xaxis is oriented in the "inverse" direction. The "normal" direction is increasing to the right for the x-axis and to the top for the y-axis; the "inverse" direction is increasing to the left for the x-axis and to the bottom for the y-axis.


matplotlib.axes.Axes.xcorr   Axes.xcorr(x, y, normed=True, detrend=<function detrend_none>, usevlines=True, maxlags=10, *, data=None, **kwargs)[source]

Plot the cross correlation between x and y. The correlation with lag k is defined as \(\sum_n x[n+k] \cdot y^*[n]\), where \(y^*\) is the complex conjugate of \(y\).  Parameters

x, yarray-like of length n

detrendcallable, default: mlab.detrend_none (no detrending)

A detrending function applied to x and y. It must have the signature detrend(x: np.ndarray) -> np.ndarray

normedbool, default: True

If True, input vectors are normalised to unit length.
usevlinesbool, default: True

Determines the plot style. If True, vertical lines are plotted from 0 to the xcorr value using Axes.vlines. Additionally, a horizontal line is plotted at y=0 using Axes.axhline. If False, markers are plotted at the xcorr values using Axes.plot.
maxlagsint, default: 10

Number of lags to show. If None, will return all 2 * len(x) - 1 lags.    Returns

lagsarray (length 2*maxlags+1)

The lag vector.
carray (length 2*maxlags+1)

The auto correlation vector.
lineLineCollection or Line2D

Artist added to the Axes of the correlation:
LineCollection if usevlines is True.
Line2D if usevlines is False.
bLine2D or None

Horizontal line at 0 if usevlines is True None usevlines is False.    Other Parameters

linestyleLine2D property, optional

The linestyle for plotting the data points. Only used if usevlines is False.
markerstr, default: 'o'

The marker for plotting the data points. Only used if usevlines is False.
dataindexable object, optional

If given, the following parameters also accept a string s, which is interpreted as data[s] (unless this raises an exception): x, y  **kwargs

Additional parameters are passed to Axes.vlines and Axes.axhline if usevlines is True; otherwise they are passed to Axes.plot.     Notes The cross correlation is performed with numpy.correlate with mode = "full".
  Examples using matplotlib.axes.Axes.xcorr

   Cross- and Auto-Correlation Demo


matplotlib.axes.Axes.yaxis_date   Axes.yaxis_date(tz=None)[source]

Set up axis ticks and labels to treat data along the yaxis as dates.  Parameters

tzstr or datetime.tzinfo, default: rcParams["timezone"] (default: 'UTC')

The timezone used to create date labels.


matplotlib.axes.Axes.yaxis_inverted   Axes.yaxis_inverted()[source]

Return whether the yaxis is oriented in the "inverse" direction. The "normal" direction is increasing to the right for the x-axis and to the top for the y-axis; the "inverse" direction is increasing to the left for the x-axis and to the bottom for the y-axis.


matplotlib.axes.Axes.zorder   Axes.zorder=0


matplotlib.axes.subplot_class_factory   matplotlib.axes.subplot_class_factory(axes_class)[source]


matplotlib.axes.SubplotBase   classmatplotlib.axes.SubplotBase(fig, *args, **kwargs)[source]

Bases: object Base class for subplots, which are Axes instances with additional methods to facilitate generating and manipulating a set of Axes within a figure.  Parameters

figmatplotlib.figure.Figure

*argstuple (nrows, ncols, index) or int

The array of subplots in the figure has dimensions (nrows,
ncols), and index is the index of the subplot being created. index starts at 1 in the upper left corner and increases to the right. If nrows, ncols, and index are all single digit numbers, then args can be passed as a single 3-digit number (e.g. 234 for (2, 3, 4)).  **kwargs

Keyword arguments are passed to the Axes (sub)class constructor.       change_geometry(numrows, numcols, num)[source]

[Deprecated] Change subplot geometry, e.g., from (1, 1, 1) to (2, 2, 3). Notes  Deprecated since version 3.4.
   propertyfigbox[source]

   get_geometry()[source]

[Deprecated] Get the subplot geometry, e.g., (2, 2, 3). Notes  Deprecated since version 3.4.
   get_gridspec()[source]

Return the GridSpec instance associated with the subplot.
   get_subplotspec()[source]

Return the SubplotSpec instance associated with the subplot.
   is_first_col()[source]

[Deprecated] Notes  Deprecated since version 3.4:
   is_first_row()[source]

[Deprecated] Notes  Deprecated since version 3.4:
   is_last_col()[source]

[Deprecated] Notes  Deprecated since version 3.4:
   is_last_row()[source]

[Deprecated] Notes  Deprecated since version 3.4:
   label_outer()[source]

Only show "outer" labels and tick labels. x-labels are only kept for subplots on the last row (or first row, if labels are on the top side); y-labels only for subplots on the first column (or last column, if labels are on the right side).
   propertynumCols[source]

   propertynumRows[source]

   set_subplotspec(subplotspec)[source]

Set the SubplotSpec. instance associated with the subplot.
   update_params()[source]

[Deprecated] Update the subplot position from self.figure.subplotpars. Notes  Deprecated since version 3.4.


change_geometry(numrows, numcols, num)[source]

[Deprecated] Change subplot geometry, e.g., from (1, 1, 1) to (2, 2, 3). Notes  Deprecated since version 3.4.


get_geometry()[source]

[Deprecated] Get the subplot geometry, e.g., (2, 2, 3). Notes  Deprecated since version 3.4.


get_gridspec()[source]

Return the GridSpec instance associated with the subplot.


get_subplotspec()[source]

Return the SubplotSpec instance associated with the subplot.


is_first_col()[source]

[Deprecated] Notes  Deprecated since version 3.4:


is_first_row()[source]

[Deprecated] Notes  Deprecated since version 3.4:


is_last_col()[source]

[Deprecated] Notes  Deprecated since version 3.4:


is_last_row()[source]

[Deprecated] Notes  Deprecated since version 3.4:


label_outer()[source]

Only show "outer" labels and tick labels. x-labels are only kept for subplots on the last row (or first row, if labels are on the top side); y-labels only for subplots on the first column (or last column, if labels are on the right side).


set_subplotspec(subplotspec)[source]

Set the SubplotSpec. instance associated with the subplot.


update_params()[source]

[Deprecated] Update the subplot position from self.figure.subplotpars. Notes  Deprecated since version 3.4.


mpl_toolkits.axes_grid  Note AxesGrid has been a part of matplotlib since v 0.99. Originally, the toolkit used the axes_grid namespace. In more recent versions, the toolkit has been split into axes_grid1 and axisartist. While axes_grid is maintained for the backward compatibility, use of axes_grid1 and axisartist is recommended. For the documentation on axes_grid, see the previous version of the docs.   mpl_toolkits.axes_grid1 mpl_toolkits.axisartist


mpl_toolkits.axes_grid1 mpl_toolkits.axes_grid1 provides a framework of helper classes to adjust the positioning of multiple fixed-aspect Axes (e.g., displaying images). It can be contrasted with the aspect property of Matplotlib Axes, which adjusts the position of a single Axes. See Overview of mpl_toolkits.axes_grid1 for a guide on the usage of axes_grid1.    The submodules of the axes_grid1 API are:
axes_grid1.anchored_artists
axes_grid1.axes_divider Helper classes to adjust the positions of multiple axes at drawing time.
axes_grid1.axes_grid
axes_grid1.axes_rgb
axes_grid1.axes_size Provides classes of simple units that will be used with AxesDivider class (or others) to determine the size of each axes.
axes_grid1.inset_locator A collection of functions and objects for creating or placing inset axes.
axes_grid1.mpl_axes
axes_grid1.parasite_axes


mpl_toolkits.axes_grid1.anchored_artists  Classes
AnchoredAuxTransformBox(transform, loc[, ...]) An anchored container with transformed coordinates.
AnchoredDirectionArrows(transform, label_x, ...) Draw two perpendicular arrows to indicate directions.
AnchoredDrawingArea(width, height, xdescent, ...) An anchored container with a fixed size and fillable DrawingArea.
AnchoredEllipse(transform, width, height, ...) Draw an anchored ellipse of a given size.
AnchoredSizeBar(transform, size, label, loc) Draw a horizontal scale bar with a center-aligned label underneath.


mpl_toolkits.axes_grid1.anchored_artists.AnchoredAuxTransformBox   classmpl_toolkits.axes_grid1.anchored_artists.AnchoredAuxTransformBox(transform, loc, pad=0.4, borderpad=0.5, prop=None, frameon=True, **kwargs)[source]

Bases: matplotlib.offsetbox.AnchoredOffsetbox An anchored container with transformed coordinates. Artists added to the drawing_area are scaled according to the coordinates of the transformation used. The dimensions of this artist will scale to contain the artists added.  Parameters

transformmatplotlib.transforms.Transform

The transformation object for the coordinate system in use, i.e., matplotlib.axes.Axes.transData.
locstr

Location of this artist. Valid locations are 'upper left', 'upper center', 'upper right', 'center left', 'center', 'center right', 'lower left', 'lower center, 'lower right'. For backward compatibility, numeric values are accepted as well. See the parameter loc of Legend for details.
padfloat, default: 0.4

Padding around the child objects, in fraction of the font size.
borderpadfloat, default: 0.5

Border padding, in fraction of the font size.
propmatplotlib.font_manager.FontProperties, optional

Font property used as a reference for paddings.
frameonbool, default: True

If True, draw a box around this artists.  **kwargs

Keyword arguments forwarded to AnchoredOffsetbox.     Examples To display an ellipse in the upper left, with a width of 0.1 and height of 0.4 in data coordinates: >>> box = AnchoredAuxTransformBox(ax.transData, loc='upper left')
>>> el = Ellipse((0, 0), width=0.1, height=0.4, angle=30)
>>> box.drawing_area.add_artist(el)
>>> ax.add_artist(box)
  Attributes

drawing_areamatplotlib.offsetbox.AuxTransformBox

A container for artists to display.       set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, bbox_to_anchor=<UNSET>, child=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, gid=<UNSET>, height=<UNSET>, in_layout=<UNSET>, label=<UNSET>, offset=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, width=<UNSET>, zorder=<UNSET>)[source]

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
bbox_to_anchor unknown
child unknown
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
figure Figure
gid str
height float
in_layout bool
label object
offset (float, float) or callable
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 float
zorder float

  Examples using mpl_toolkits.axes_grid1.anchored_artists.AnchoredAuxTransformBox

   Annotations


set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, bbox_to_anchor=<UNSET>, child=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, gid=<UNSET>, height=<UNSET>, in_layout=<UNSET>, label=<UNSET>, offset=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, width=<UNSET>, zorder=<UNSET>)[source]

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
bbox_to_anchor unknown
child unknown
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
figure Figure
gid str
height float
in_layout bool
label object
offset (float, float) or callable
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 float
zorder float