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

Place a legend on the Axes. Call signatures: legend()
legend(handles, labels)
legend(handles=handles)
legend(labels)
 The call signatures correspond to the following different ways to use this method: 1. Automatic detection of elements to be shown in the legend The elements to be added to the legend are automatically determined, when you do not pass in any extra arguments. In this case, the labels are taken from the artist. You can specify them either at artist creation or by calling the set_label() method on the artist: ax.plot([1, 2, 3], label='Inline label')
ax.legend()
 or: line, = ax.plot([1, 2, 3])
line.set_label('Label via method')
ax.legend()
 Specific lines can be excluded from the automatic legend element selection by defining a label starting with an underscore. This is default for all artists, so calling Axes.legend without any arguments and without setting the labels manually will result in no legend being drawn. 2. Explicitly listing the artists and labels in the legend For full control of which artists have a legend entry, it is possible to pass an iterable of legend artists followed by an iterable of legend labels respectively: ax.legend([line1, line2, line3], ['label1', 'label2', 'label3'])
 3. Explicitly listing the artists in the legend This is similar to 2, but the labels are taken from the artists' label properties. Example: line1, = ax.plot([1, 2, 3], label='label1')
line2, = ax.plot([1, 2, 3], label='label2')
ax.legend(handles=[line1, line2])
 4. Labeling existing plot elements  Discouraged This call signature is discouraged, because the relation between plot elements and labels is only implicit by their order and can easily be mixed up.  To make a legend for all artists on an Axes, call this function with an iterable of strings, one for each legend item. For example: ax.plot([1, 2, 3])
ax.plot([5, 6, 7])
ax.legend(['First line', 'Second line'])
  Parameters

handlessequence of Artist, optional

A list of Artists (lines, patches) to be added to the legend. Use this together with labels, if you need full control on what is shown in the legend and the automatic mechanism described above is not sufficient. The length of handles and labels should be the same in this case. If they are not, they are truncated to the smaller length.
labelslist of str, optional

A list of labels to show next to the artists. Use this together with handles, if you need full control on what is shown in the legend and the automatic mechanism described above is not sufficient.    Returns
 Legend
  Other Parameters

locstr or pair of floats, default: rcParams["legend.loc"] (default: 'best') ('best' for axes, 'upper right' for figures)

The location of the legend. The strings 'upper left', 'upper right', 'lower left', 'lower right' place the legend at the corresponding corner of the axes/figure. The strings 'upper center', 'lower center', 'center left', 'center right' place the legend at the center of the corresponding edge of the axes/figure. The string 'center' places the legend at the center of the axes/figure. The string 'best' places the legend at the location, among the nine locations defined so far, with the minimum overlap with other drawn artists. This option can be quite slow for plots with large amounts of data; your plotting speed may benefit from providing a specific location. The location can also be a 2-tuple giving the coordinates of the lower-left corner of the legend in axes coordinates (in which case bbox_to_anchor will be ignored). For back-compatibility, 'center right' (but no other location) can also be spelled 'right', and each "string" locations can also be given as a numeric value:
Location String Location Code
'best' 0
'upper right' 1
'upper left' 2
'lower left' 3
'lower right' 4
'right' 5
'center left' 6
'center right' 7
'lower center' 8
'upper center' 9
'center' 10
bbox_to_anchorBboxBase, 2-tuple, or 4-tuple of floats

Box that is used to position the legend in conjunction with loc. Defaults to axes.bbox (if called as a method to Axes.legend) or figure.bbox (if Figure.legend). This argument allows arbitrary placement of the legend. Bbox coordinates are interpreted in the coordinate system given by bbox_transform, with the default transform Axes or Figure coordinates, depending on which legend is called. If a 4-tuple or BboxBase is given, then it specifies the bbox (x, y, width, height) that the legend is placed in. To put the legend in the best location in the bottom right quadrant of the axes (or figure): loc='best', bbox_to_anchor=(0.5, 0., 0.5, 0.5)
 A 2-tuple (x, y) places the corner of the legend specified by loc at x, y. For example, to put the legend's upper right-hand corner in the center of the axes (or figure) the following keywords can be used: loc='upper right', bbox_to_anchor=(0.5, 0.5)

ncolint, default: 1

The number of columns that the legend has.
propNone or matplotlib.font_manager.FontProperties or dict

The font properties of the legend. If None (default), the current matplotlib.rcParams will be used.
fontsizeint or {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}

The font size of the legend. If the value is numeric the size will be the absolute font size in points. String values are relative to the current default font size. This argument is only used if prop is not specified.
labelcolorstr or list, default: rcParams["legend.labelcolor"] (default: 'None')

The color of the text in the legend. Either a valid color string (for example, 'red'), or a list of color strings. The labelcolor can also be made to match the color of the line or marker using 'linecolor', 'markerfacecolor' (or 'mfc'), or 'markeredgecolor' (or 'mec'). Labelcolor can be set globally using rcParams["legend.labelcolor"] (default: 'None'). If None, use rcParams["text.color"] (default: 'black').
numpointsint, default: rcParams["legend.numpoints"] (default: 1)

The number of marker points in the legend when creating a legend entry for a Line2D (line).
scatterpointsint, default: rcParams["legend.scatterpoints"] (default: 1)

The number of marker points in the legend when creating a legend entry for a PathCollection (scatter plot).
scatteryoffsetsiterable of floats, default: [0.375, 0.5, 0.3125]

The vertical offset (relative to the font size) for the markers created for a scatter plot legend entry. 0.0 is at the base the legend text, and 1.0 is at the top. To draw all markers at the same height, set to [0.5].
markerscalefloat, default: rcParams["legend.markerscale"] (default: 1.0)

The relative size of legend markers compared with the originally drawn ones.
markerfirstbool, default: True

If True, legend marker is placed to the left of the legend label. If False, legend marker is placed to the right of the legend label.
frameonbool, default: rcParams["legend.frameon"] (default: True)

Whether the legend should be drawn on a patch (frame).
fancyboxbool, default: rcParams["legend.fancybox"] (default: True)

Whether round edges should be enabled around the FancyBboxPatch which makes up the legend's background.
shadowbool, default: rcParams["legend.shadow"] (default: False)

Whether to draw a shadow behind the legend.
framealphafloat, default: rcParams["legend.framealpha"] (default: 0.8)

The alpha transparency of the legend's background. If shadow is activated and framealpha is None, the default value is ignored.
facecolor"inherit" or color, default: rcParams["legend.facecolor"] (default: 'inherit')

The legend's background color. If "inherit", use rcParams["axes.facecolor"] (default: 'white').
edgecolor"inherit" or color, default: rcParams["legend.edgecolor"] (default: '0.8')

The legend's background patch edge color. If "inherit", use take rcParams["axes.edgecolor"] (default: 'black').
mode{"expand", None}

If mode is set to "expand" the legend will be horizontally expanded to fill the axes area (or bbox_to_anchor if defines the legend's size).
bbox_transformNone or matplotlib.transforms.Transform

The transform for the bounding box (bbox_to_anchor). For a value of None (default) the Axes' transAxes transform will be used.
titlestr or None

The legend's title. Default is no title (None).
title_fontpropertiesNone or matplotlib.font_manager.FontProperties or dict

The font properties of the legend's title. If None (default), the title_fontsize argument will be used if present; if title_fontsize is also None, the current rcParams["legend.title_fontsize"] (default: None) will be used.
title_fontsizeint or {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}, default: rcParams["legend.title_fontsize"] (default: None)

The font size of the legend's title. Note: This cannot be combined with title_fontproperties. If you want to set the fontsize alongside other font properties, use the size parameter in title_fontproperties.
borderpadfloat, default: rcParams["legend.borderpad"] (default: 0.4)

The fractional whitespace inside the legend border, in font-size units.
labelspacingfloat, default: rcParams["legend.labelspacing"] (default: 0.5)

The vertical space between the legend entries, in font-size units.
handlelengthfloat, default: rcParams["legend.handlelength"] (default: 2.0)

The length of the legend handles, in font-size units.
handleheightfloat, default: rcParams["legend.handleheight"] (default: 0.7)

The height of the legend handles, in font-size units.
handletextpadfloat, default: rcParams["legend.handletextpad"] (default: 0.8)

The pad between the legend handle and text, in font-size units.
borderaxespadfloat, default: rcParams["legend.borderaxespad"] (default: 0.5)

The pad between the axes and legend border, in font-size units.
columnspacingfloat, default: rcParams["legend.columnspacing"] (default: 2.0)

The spacing between columns, in font-size units.
handler_mapdict or None

The custom dictionary mapping instances or types to a legend handler. This handler_map updates the default handler map found at matplotlib.legend.Legend.get_legend_handler_map.      See also  Figure.legend
  Notes Some artists are not supported by this function. See Legend guide for details. Examples (Source code, png, pdf)
  Examples using matplotlib.axes.Axes.legend

   Bar Label Demo

   Stacked bar chart

   Grouped bar chart with labels

   Plotting categorical variables

   Fill Between and Alpha

   Hat graph

   Customizing dashed line styles

   Lines with a ticked patheffect

   prop_cycle property markevery in rcParams

   Scatter plots with a legend

   Stackplots and streamgraphs

   Stairs Demo

   Contourf Hatching

   Tricontour Demo

   Secondary Axis

   Plot a confidence ellipse of a two-dimensional dataset

   Using histograms to plot a cumulative distribution

   The histogram (hist) function with multiple data sets

   Bar of pie

   Labeling a pie and a donut

   Polar Legend

   Composing Custom Legends

   Legend using pre-defined labels

   Legend Demo

   Mathtext

   Rendering math equations using TeX

   Parasite Axes demo

   Parasite axis demo

   Anatomy of a figure

   Legend Picking

   Patheffect Demo

   TickedStroke patheffect

   Plot 2D data on 3D plot

   Parametric Curve

   Multiple Yaxis With Spines

   Group barchart with units

   Simple Legend01

   Simple Legend02

   Basic Usage

   Legend guide

   Constrained Layout Guide

   Tight Layout guide

   Specifying Colors


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

Control behavior of major tick locators. Because the locator is involved in autoscaling, autoscale_view is called automatically after the parameters are changed.  Parameters

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

The axis on which to operate.
tightbool or None, optional

Parameter passed to autoscale_view. Default is None, for no change.    Other Parameters
 **kwargs

Remaining keyword arguments are passed to directly to the set_params() method of the locator. Supported keywords depend on the type of the locator. See for example set_params for the ticker.MaxNLocator used by default for linear axes.     Examples When plotting small subplots, one might want to reduce the maximum number of ticks and use tight bounds, for example: ax.locator_params(tight=True, nbins=4)

  Examples using matplotlib.axes.Axes.locator_params

   Contourf Demo

   Constrained Layout Guide

   Tight Layout guide


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

Make a plot with log scaling on both the x and y axis. Call signatures: loglog([x], y, [fmt], data=None, **kwargs)
loglog([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)
 This is just a thin wrapper around plot which additionally changes both the x-axis and the y-axis to log scaling. All of the concepts and parameters of plot can be used here as well. The additional parameters base, subs and nonpositive control the x/y-axis properties. They are just forwarded to Axes.set_xscale and Axes.set_yscale. To use different properties on the x-axis and the y-axis, use e.g. ax.set_xscale("log", base=10); ax.set_yscale("log", base=2).  Parameters

basefloat, default: 10

Base of the logarithm.
subssequence, optional

The location of the minor ticks. If None, reasonable locations are automatically chosen depending on the number of decades in the plot. See Axes.set_xscale/Axes.set_yscale for details.
nonpositive{'mask', 'clip'}, default: 'mask'

Non-positive values can be masked as invalid, or clipped to a very small positive number.  **kwargs

All parameters supported by plot.    Returns
 list of Line2D

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

   Secondary Axis

   Log Demo


matplotlib.axes.Axes.magnitude_spectrum   Axes.magnitude_spectrum(x, Fs=None, Fc=None, window=None, pad_to=None, sides=None, scale=None, *, data=None, **kwargs)[source]

Plot the magnitude spectrum. Compute the magnitude spectrum of x. Data is padded to a length of pad_to and the windowing function window is applied to the signal.  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. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to the length of the input signal (i.e. no padding).
scale{'default', 'linear', 'dB'}

The scaling of the values in the spec. 'linear' is no scaling. 'dB' returns the values in dB scale, i.e., the dB amplitude (20 * log10). 'default' is 'linear'.
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.    Returns

spectrum1-D array

The values for the magnitude spectrum before scaling (real valued).
freqs1-D array

The frequencies corresponding to the elements in spectrum.
lineLine2D

The line created by this function.    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  **kwargs

Keyword arguments control the Line2D properties:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color or c color
dash_capstyle CapStyle or {'butt', 'projecting', 'round'}
dash_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
dashes sequence of floats (on/off ink in points) or (None, None)
data (2, N) array or two 1D arrays
drawstyle or ds {'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'
figure Figure
fillstyle {'full', 'left', 'right', 'bottom', 'top', 'none'}
gid str
in_layout bool
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float
marker marker style string, Path or MarkerStyle
markeredgecolor or mec color
markeredgewidth or mew float
markerfacecolor or mfc color
markerfacecoloralt or mfcalt color
markersize or ms float
markevery None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool]
path_effects AbstractPathEffect
picker float or callable[[Artist, Event], tuple[bool, dict]]
pickradius float
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
solid_capstyle CapStyle or {'butt', 'projecting', 'round'}
solid_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
transform unknown
url str
visible bool
xdata 1D array
ydata 1D array
zorder float        See also  psd

Plots the power spectral density.  angle_spectrum

Plots the angles of the corresponding frequencies.  phase_spectrum

Plots the phase (unwrapped angle) of the corresponding frequencies.  specgram

Can plot the magnitude spectrum of segments within the signal in a colormap.


matplotlib.axes.Axes.margins   Axes.margins(*margins, x=None, y=None, tight=True)[source]

Set or retrieve autoscaling margins. The padding added to each limit of the Axes is the margin times the data interval. All input parameters must be floats within the range [0, 1]. Passing both positional and keyword arguments is invalid and will raise a TypeError. If no arguments (positional or otherwise) are provided, the current margins will remain in place and simply be returned. Specifying any margin changes only the autoscaling; for example, if xmargin is not None, then xmargin times the X data interval will be added to each end of that interval before it is used in autoscaling.  Parameters

*marginsfloat, optional

If a single positional argument is provided, it specifies both margins of the x-axis and y-axis limits. If two positional arguments are provided, they will be interpreted as xmargin, ymargin. If setting the margin on a single axis is desired, use the keyword arguments described below.
x, yfloat, optional

Specific margin values for the x-axis and y-axis, respectively. These cannot be used with positional arguments, but can be used individually to alter on e.g., only the y-axis.
tightbool or None, default: True

The tight parameter is passed to autoscale_view(), which is executed after a margin is changed; the default here is True, on the assumption that when margins are specified, no additional padding to match tick marks is usually desired. Set tight to None will preserve the previous setting.    Returns

xmargin, ymarginfloat

   Notes If a previously used Axes method such as pcolor() has set use_sticky_edges to True, only the limits not set by the "sticky artists" will be modified. To force all of the margins to be set, set use_sticky_edges to False before calling margins().
  Examples using matplotlib.axes.Axes.margins

   Marker reference

   Creating a timeline with lines, dates, and text

   Trigradient Demo

   Controlling view limits using margins and sticky_edges

   Scale invariant angle label

   ggplot style sheet

   Autoscaling


matplotlib.axes.Axes.matshow   Axes.matshow(Z, **kwargs)[source]

Plot the values of a 2D matrix or array as color-coded image. The matrix will be shown the way it would be printed, with the first row at the top. Row and column numbering is zero-based.  Parameters

Z(M, N) array-like

The matrix to be displayed.    Returns
 AxesImage
  Other Parameters

**kwargsimshow arguments

    See also  imshow

More general function to plot data on a 2D regular raster.    Notes This is just a convenience function wrapping imshow to set useful defaults for displaying a matrix. In particular:  Set origin='upper'. Set interpolation='nearest'. Set aspect='equal'. Ticks are placed to the left and above. Ticks are formatted to show integer indices.


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

Remove minor ticks from the Axes.


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

Display minor ticks on the Axes. Displaying minor ticks may reduce performance; you may turn them off using minorticks_off() if drawing speed is a problem.
  Examples using matplotlib.axes.Axes.minorticks_on

   MRI With EEG


matplotlib.axes.Axes.mouseover   propertyAxes.mouseover

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


matplotlib.axes.Axes.name   Axes.name='rectilinear'


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

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


matplotlib.axes.Axes.pcolor   Axes.pcolor(*args, shading=None, alpha=None, norm=None, cmap=None, vmin=None, vmax=None, data=None, **kwargs)[source]

Create a pseudocolor plot with a non-regular rectangular grid. Call signature: pcolor([X, Y,] C, **kwargs)
 X and Y can be used to specify the corners of the quadrilaterals.  Hint pcolor() can be very slow for large arrays. In most cases you should use the similar but much faster pcolormesh instead. See Differences between pcolor() and pcolormesh() for a discussion of the differences.   Parameters

C2D array-like

The color-mapped values.
X, Yarray-like, optional

The coordinates of the corners of quadrilaterals of a pcolormesh: (X[i+1, j], Y[i+1, j])       (X[i+1, j+1], Y[i+1, j+1])
                      +-----+
                      |     |
                      +-----+
    (X[i, j], Y[i, j])       (X[i, j+1], Y[i, j+1])
 Note that the column index corresponds to the x-coordinate, and the row index corresponds to y. For details, see the Notes section below. If shading='flat' the dimensions of X and Y should be one greater than those of C, and the quadrilateral is colored due to the value at C[i, j]. If X, Y and C have equal dimensions, a warning will be raised and the last row and column of C will be ignored. If shading='nearest', the dimensions of X and Y should be the same as those of C (if not, a ValueError will be raised). The color C[i, j] will be centered on (X[i, j], Y[i, j]). If X and/or Y are 1-D arrays or column vectors they will be expanded as needed into the appropriate 2D arrays, making a rectangular grid.
shading{'flat', 'nearest', 'auto'}, default: rcParams["pcolor.shading"] (default: 'auto')

The fill style for the quadrilateral. Possible values:  'flat': A solid color is used for each quad. The color of the quad (i, j), (i+1, j), (i, j+1), (i+1, j+1) is given by C[i, j]. The dimensions of X and Y should be one greater than those of C; if they are the same as C, then a deprecation warning is raised, and the last row and column of C are dropped. 'nearest': Each grid point will have a color centered on it, extending halfway between the adjacent grid centers. The dimensions of X and Y must be the same as C. 'auto': Choose 'flat' if dimensions of X and Y are one larger than C. Choose 'nearest' if dimensions are the same.  See pcolormesh grids and shading for more description.
cmapstr or Colormap, default: rcParams["image.cmap"] (default: 'viridis')

A Colormap instance or registered colormap name. The colormap maps the C values to colors.
normNormalize, optional

The Normalize instance scales the data values to the canonical colormap range [0, 1] for mapping to colors. By default, the data range is mapped to the colorbar range using linear scaling.
vmin, vmaxfloat, default: None

The colorbar range. If None, suitable min/max values are automatically chosen by the Normalize instance (defaults to the respective min/max values of C in case of the default linear scaling). It is an error to use vmin/vmax when norm is given.
edgecolors{'none', None, 'face', color, color sequence}, optional

The color of the edges. Defaults to 'none'. Possible values:  'none' or '': No edge.
None: rcParams["patch.edgecolor"] (default: 'black') will be used. Note that currently rcParams["patch.force_edgecolor"] (default: False) has to be True for this to work. 'face': Use the adjacent face color. A color or sequence of colors will set the edge color.  The singular form edgecolor works as an alias.
alphafloat, default: None

The alpha blending value of the face color, between 0 (transparent) and 1 (opaque). Note: The edgecolor is currently not affected by this.
snapbool, default: False

Whether to snap the mesh to pixel boundaries.    Returns
 matplotlib.collections.Collection
  Other Parameters

antialiasedsbool, default: False

The default antialiaseds is False if the default edgecolors="none" is used. This eliminates artificial lines at patch boundaries, and works regardless of the value of alpha. If edgecolors is not "none", then the default antialiaseds is taken from rcParams["patch.antialiased"] (default: True). Stroking the edges may be preferred if alpha is 1, but will cause artifacts otherwise.
dataindexable object, optional

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

Additionally, the following arguments are allowed. They are passed along to the PolyCollection constructor:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha array-like or scalar or None
animated bool
antialiased or aa or antialiaseds bool or list of bools
array array-like or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clim (vmin: float, vmax: float)
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
cmap Colormap or str or None
color color or list of rgba tuples
edgecolor or ec or edgecolors color or list of colors or 'face'
facecolor or facecolors or fc color or list of colors
figure Figure
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or dashes or linestyles or ls str or tuple or list thereof
linewidth or linewidths or lw float or list of floats
norm Normalize or None
offset_transform Transform
offsets (N, 2) or (2,) array-like
path_effects AbstractPathEffect
paths list of array-like
picker None or bool or float or callable
pickradius float
rasterized bool
sizes ndarray or None
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
urls list of str or None
verts list of array-like
verts_and_codes unknown
visible bool
zorder float        See also  pcolormesh

for an explanation of the differences between pcolor and pcolormesh.  imshow

If X and Y are each equidistant, imshow can be a faster alternative.    Notes Masked arrays X, Y and C may be masked arrays. If either C[i, j], or one of the vertices surrounding C[i, j] (X or Y at [i, j], [i+1, j], [i, j+1], [i+1, j+1]) is masked, nothing is plotted. Grid orientation The grid orientation follows the standard matrix convention: An array C with shape (nrows, ncolumns) is plotted with the column number as X and the row number as Y.
  Examples using matplotlib.axes.Axes.pcolor

   Pcolor Demo

   Controlling view limits using margins and sticky_edges


matplotlib.axes.Axes.pcolorfast   Axes.pcolorfast(*args, alpha=None, norm=None, cmap=None, vmin=None, vmax=None, data=None, **kwargs)[source]

Create a pseudocolor plot with a non-regular rectangular grid. Call signature: ax.pcolorfast([X, Y], C, /, **kwargs)
 This method is similar to pcolor and pcolormesh. It's designed to provide the fastest pcolor-type plotting with the Agg backend. To achieve this, it uses different algorithms internally depending on the complexity of the input grid (regular rectangular, non-regular rectangular or arbitrary quadrilateral).  Warning This method is experimental. Compared to pcolor or pcolormesh it has some limitations:  It supports only flat shading (no outlines) It lacks support for log scaling of the axes. It does not have a have a pyplot wrapper.    Parameters

Carray-like

The image data. Supported array shapes are:  (M, N): an image with scalar data. The data is visualized using a colormap. (M, N, 3): an image with RGB values (0-1 float or 0-255 int). (M, N, 4): an image with RGBA values (0-1 float or 0-255 int), i.e. including transparency.  The first two dimensions (M, N) define the rows and columns of the image. This parameter can only be passed positionally.
X, Ytuple or array-like, default: (0, N), (0, M)

X and Y are used to specify the coordinates of the quadrilaterals. There are different ways to do this:
Use tuples X=(xmin, xmax) and Y=(ymin, ymax) to define a uniform rectangular grid. The tuples define the outer edges of the grid. All individual quadrilaterals will be of the same size. This is the fastest version.
Use 1D arrays X, Y to specify a non-uniform rectangular grid. In this case X and Y have to be monotonic 1D arrays of length N+1 and M+1, specifying the x and y boundaries of the cells. The speed is intermediate. Note: The grid is checked, and if found to be uniform the fast version is used.
Use 2D arrays X, Y if you need an arbitrary quadrilateral grid (i.e. if the quadrilaterals are not rectangular). In this case X and Y are 2D arrays with shape (M + 1, N + 1), specifying the x and y coordinates of the corners of the colored quadrilaterals. This is the most general, but the slowest to render. It may produce faster and more compact output using ps, pdf, and svg backends, however.   These arguments can only be passed positionally.
cmapstr or Colormap, default: rcParams["image.cmap"] (default: 'viridis')

A Colormap instance or registered colormap name. The colormap maps the C values to colors.
normNormalize, optional

The Normalize instance scales the data values to the canonical colormap range [0, 1] for mapping to colors. By default, the data range is mapped to the colorbar range using linear scaling.
vmin, vmaxfloat, default: None

The colorbar range. If None, suitable min/max values are automatically chosen by the Normalize instance (defaults to the respective min/max values of C in case of the default linear scaling). It is an error to use vmin/vmax when norm is given.
alphafloat, default: None

The alpha blending value, between 0 (transparent) and 1 (opaque).
snapbool, default: False

Whether to snap the mesh to pixel boundaries.    Returns

AxesImage or PcolorImage or QuadMesh

The return type depends on the type of grid:
AxesImage for a regular rectangular grid.
PcolorImage for a non-regular rectangular grid.
QuadMesh for a non-rectangular grid.     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

Supported additional parameters depend on the type of grid. See return types of image for further description.
  Examples using matplotlib.axes.Axes.pcolorfast

   Pcolor Demo


matplotlib.axes.Axes.pcolormesh   Axes.pcolormesh(*args, alpha=None, norm=None, cmap=None, vmin=None, vmax=None, shading=None, antialiased=False, data=None, **kwargs)[source]

Create a pseudocolor plot with a non-regular rectangular grid. Call signature: pcolormesh([X, Y,] C, **kwargs)
 X and Y can be used to specify the corners of the quadrilaterals.  Hint pcolormesh is similar to pcolor. It is much faster and preferred in most cases. For a detailed discussion on the differences see Differences between pcolor() and pcolormesh().   Parameters

C2D array-like

The color-mapped values.
X, Yarray-like, optional

The coordinates of the corners of quadrilaterals of a pcolormesh: (X[i+1, j], Y[i+1, j])       (X[i+1, j+1], Y[i+1, j+1])
                      +-----+
                      |     |
                      +-----+
    (X[i, j], Y[i, j])       (X[i, j+1], Y[i, j+1])
 Note that the column index corresponds to the x-coordinate, and the row index corresponds to y. For details, see the Notes section below. If shading='flat' the dimensions of X and Y should be one greater than those of C, and the quadrilateral is colored due to the value at C[i, j]. If X, Y and C have equal dimensions, a warning will be raised and the last row and column of C will be ignored. If shading='nearest' or 'gouraud', the dimensions of X and Y should be the same as those of C (if not, a ValueError will be raised). For 'nearest' the color C[i, j] is centered on (X[i, j], Y[i, j]). For 'gouraud', a smooth interpolation is caried out between the quadrilateral corners. If X and/or Y are 1-D arrays or column vectors they will be expanded as needed into the appropriate 2D arrays, making a rectangular grid.
cmapstr or Colormap, default: rcParams["image.cmap"] (default: 'viridis')

A Colormap instance or registered colormap name. The colormap maps the C values to colors.
normNormalize, optional

The Normalize instance scales the data values to the canonical colormap range [0, 1] for mapping to colors. By default, the data range is mapped to the colorbar range using linear scaling.
vmin, vmaxfloat, default: None

The colorbar range. If None, suitable min/max values are automatically chosen by the Normalize instance (defaults to the respective min/max values of C in case of the default linear scaling). It is an error to use vmin/vmax when norm is given.
edgecolors{'none', None, 'face', color, color sequence}, optional

The color of the edges. Defaults to 'none'. Possible values:  'none' or '': No edge.
None: rcParams["patch.edgecolor"] (default: 'black') will be used. Note that currently rcParams["patch.force_edgecolor"] (default: False) has to be True for this to work. 'face': Use the adjacent face color. A color or sequence of colors will set the edge color.  The singular form edgecolor works as an alias.
alphafloat, default: None

The alpha blending value, between 0 (transparent) and 1 (opaque).
shading{'flat', 'nearest', 'gouraud', 'auto'}, optional

The fill style for the quadrilateral; defaults to 'flat' or rcParams["pcolor.shading"] (default: 'auto'). Possible values:  'flat': A solid color is used for each quad. The color of the quad (i, j), (i+1, j), (i, j+1), (i+1, j+1) is given by C[i, j]. The dimensions of X and Y should be one greater than those of C; if they are the same as C, then a deprecation warning is raised, and the last row and column of C are dropped. 'nearest': Each grid point will have a color centered on it, extending halfway between the adjacent grid centers. The dimensions of X and Y must be the same as C. 'gouraud': Each quad will be Gouraud shaded: The color of the corners (i', j') are given by C[i', j']. The color values of the area in between is interpolated from the corner values. The dimensions of X and Y must be the same as C. When Gouraud shading is used, edgecolors is ignored. 'auto': Choose 'flat' if dimensions of X and Y are one larger than C. Choose 'nearest' if dimensions are the same.  See pcolormesh grids and shading for more description.
snapbool, default: False

Whether to snap the mesh to pixel boundaries.
rasterizedbool, optional

Rasterize the pcolormesh when drawing vector graphics. This can speed up rendering and produce smaller files for large data sets. See also Rasterization for vector graphics.    Returns
 matplotlib.collections.QuadMesh
  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

Additionally, the following arguments are allowed. They are passed along to the QuadMesh constructor:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha array-like or scalar or None
animated bool
antialiased or aa or antialiaseds bool or list of bools
array (M, N) array-like or M*N array-like
capstyle CapStyle or {'butt', 'projecting', 'round'}
clim (vmin: float, vmax: float)
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
cmap Colormap or str or None
color color or list of rgba tuples
edgecolor or ec or edgecolors color or list of colors or 'face'
facecolor or facecolors or fc color or list of colors
figure Figure
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or dashes or linestyles or ls str or tuple or list thereof
linewidth or linewidths or lw float or list of floats
norm Normalize or None
offset_transform Transform
offsets (N, 2) or (2,) array-like
path_effects AbstractPathEffect
picker None or bool or float or callable
pickradius float
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
urls list of str or None
visible bool
zorder float        See also  pcolor

An alternative implementation with slightly different features. For a detailed discussion on the differences see Differences between pcolor() and pcolormesh().  imshow

If X and Y are each equidistant, imshow can be a faster alternative.    Notes Masked arrays C may be a masked array. If C[i, j] is masked, the corresponding quadrilateral will be transparent. Masking of X and Y is not supported. Use pcolor if you need this functionality. Grid orientation The grid orientation follows the standard matrix convention: An array C with shape (nrows, ncolumns) is plotted with the column number as X and the row number as Y. Differences between pcolor() and pcolormesh() Both methods are used to create a pseudocolor plot of a 2D array using quadrilaterals. The main difference lies in the created object and internal data handling: While pcolor returns a PolyCollection, pcolormesh returns a QuadMesh. The latter is more specialized for the given purpose and thus is faster. It should almost always be preferred. There is also a slight difference in the handling of masked arrays. Both pcolor and pcolormesh support masked arrays for C. However, only pcolor supports masked arrays for X and Y. The reason lies in the internal handling of the masked values. pcolor leaves out the respective polygons from the PolyCollection. pcolormesh sets the facecolor of the masked elements to transparent. You can see the difference when using edgecolors. While all edges are drawn irrespective of masking in a QuadMesh, the edge between two adjacent masked quadrilaterals in pcolor is not drawn as the corresponding polygons do not exist in the PolyCollection. Another difference is the support of Gouraud shading in pcolormesh, which is not available with pcolor.
  Examples using matplotlib.axes.Axes.pcolormesh

   Pcolor Demo

   pcolormesh grids and shading

   pcolormesh

   Placing Colorbars

   Figure subfigures

   Rasterization for vector graphics

   Constrained Layout Guide

   Colormap Normalization

   pcolormesh(X, Y, Z)


matplotlib.axes.Axes.phase_spectrum   Axes.phase_spectrum(x, Fs=None, Fc=None, window=None, pad_to=None, sides=None, *, data=None, **kwargs)[source]

Plot the phase spectrum. Compute the phase spectrum (unwrapped angle spectrum) of x. Data is padded to a length of pad_to and the windowing function window is applied to the signal.  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. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to the length of the input signal (i.e. no padding).
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.    Returns

spectrum1-D array

The values for the phase spectrum in radians (real valued).
freqs1-D array

The frequencies corresponding to the elements in spectrum.
lineLine2D

The line created by this function.    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  **kwargs

Keyword arguments control the Line2D properties:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color or c color
dash_capstyle CapStyle or {'butt', 'projecting', 'round'}
dash_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
dashes sequence of floats (on/off ink in points) or (None, None)
data (2, N) array or two 1D arrays
drawstyle or ds {'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'
figure Figure
fillstyle {'full', 'left', 'right', 'bottom', 'top', 'none'}
gid str
in_layout bool
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float
marker marker style string, Path or MarkerStyle
markeredgecolor or mec color
markeredgewidth or mew float
markerfacecolor or mfc color
markerfacecoloralt or mfcalt color
markersize or ms float
markevery None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool]
path_effects AbstractPathEffect
picker float or callable[[Artist, Event], tuple[bool, dict]]
pickradius float
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
solid_capstyle CapStyle or {'butt', 'projecting', 'round'}
solid_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
transform unknown
url str
visible bool
xdata 1D array
ydata 1D array
zorder float        See also  magnitude_spectrum

Plots the magnitudes of the corresponding frequencies.  angle_spectrum

Plots the wrapped version of this function.  specgram

Can plot the phase spectrum of segments within the signal in a colormap.


matplotlib.axes.Axes.pie   Axes.pie(x, explode=None, labels=None, colors=None, autopct=None, pctdistance=0.6, shadow=False, labeldistance=1.1, startangle=0, radius=1, counterclock=True, wedgeprops=None, textprops=None, center=(0, 0), frame=False, rotatelabels=False, *, normalize=True, data=None)[source]

Plot a pie chart. Make a pie chart of array x. The fractional area of each wedge is given by x/sum(x). If sum(x) < 1, then the values of x give the fractional area directly and the array will not be normalized. The resulting pie will have an empty wedge of size 1 - sum(x). The wedges are plotted counterclockwise, by default starting from the x-axis.  Parameters

x1D array-like

The wedge sizes.
explodearray-like, default: None

If not None, is a len(x) array which specifies the fraction of the radius with which to offset each wedge.
labelslist, default: None

A sequence of strings providing the labels for each wedge
colorsarray-like, default: None

A sequence of colors through which the pie chart will cycle. If None, will use the colors in the currently active cycle.
autopctNone or str or callable, default: None

If not None, is a string or function used to label the wedges with their numeric value. The label will be placed inside the wedge. If it is a format string, the label will be fmt % pct. If it is a function, it will be called.
pctdistancefloat, default: 0.6

The ratio between the center of each pie slice and the start of the text generated by autopct. Ignored if autopct is None.
shadowbool, default: False

Draw a shadow beneath the pie.
normalizebool, default: True

When True, always make a full pie by normalizing x so that sum(x) == 1. False makes a partial pie if sum(x) <= 1 and raises a ValueError for sum(x) > 1.
labeldistancefloat or None, default: 1.1

The radial distance at which the pie labels are drawn. If set to None, label are not drawn, but are stored for use in legend()
startanglefloat, default: 0 degrees

The angle by which the start of the pie is rotated, counterclockwise from the x-axis.
radiusfloat, default: 1

The radius of the pie.
counterclockbool, default: True

Specify fractions direction, clockwise or counterclockwise.
wedgepropsdict, default: None

Dict of arguments passed to the wedge objects making the pie. For example, you can pass in wedgeprops = {'linewidth': 3} to set the width of the wedge border lines equal to 3. For more details, look at the doc/arguments of the wedge object. By default clip_on=False.
textpropsdict, default: None

Dict of arguments to pass to the text objects.
center(float, float), default: (0, 0)

The coordinates of the center of the chart.
framebool, default: False

Plot Axes frame with the chart if true.
rotatelabelsbool, default: False

Rotate each label to the angle of the corresponding slice if true.
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, explode, labels, colors    Returns

patcheslist

A sequence of matplotlib.patches.Wedge instances
textslist

A list of the label Text instances.
autotextslist

A list of Text instances for the numeric labels. This will only be returned if the parameter autopct is not None.     Notes The pie chart will probably look best if the figure and Axes are square, or the Axes aspect is equal. This method sets the aspect ratio of the axis to "equal". The Axes aspect ratio can be controlled with Axes.set_aspect.
  Examples using matplotlib.axes.Axes.pie

   Basic pie chart

   Bar of pie

   Nested pie charts

   Labeling a pie and a donut

   SVG Filter Pie

   pie(x)


matplotlib.axes.Axes.plot   Axes.plot(*args, scalex=True, scaley=True, data=None, **kwargs)[source]

Plot y versus x as lines and/or markers. Call signatures: plot([x], y, [fmt], *, data=None, **kwargs)
plot([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)
 The coordinates of the points or line nodes are given by x, y. The optional parameter fmt is a convenient way for defining basic formatting like color, marker and linestyle. It's a shortcut string notation described in the Notes section below. >>> plot(x, y)        # plot x and y using default line style and color
>>> plot(x, y, 'bo')  # plot x and y using blue circle markers
>>> plot(y)           # plot y using x as index array 0..N-1
>>> plot(y, 'r+')     # ditto, but with red plusses
 You can use Line2D properties as keyword arguments for more control on the appearance. Line properties and fmt can be mixed. The following two calls yield identical results: >>> plot(x, y, 'go--', linewidth=2, markersize=12)
>>> plot(x, y, color='green', marker='o', linestyle='dashed',
...      linewidth=2, markersize=12)
 When conflicting with fmt, keyword arguments take precedence. Plotting labelled data There's a convenient way for plotting objects with labelled data (i.e. data that can be accessed by index obj['y']). Instead of giving the data in x and y, you can provide the object in the data parameter and just give the labels for x and y: >>> plot('xlabel', 'ylabel', data=obj)
 All indexable objects are supported. This could e.g. be a dict, a pandas.DataFrame or a structured numpy array. Plotting multiple sets of data There are various ways to plot multiple sets of data.
The most straight forward way is just to call plot multiple times. Example: >>> plot(x1, y1, 'bo')
>>> plot(x2, y2, 'go')

If x and/or y are 2D arrays a separate data set will be drawn for every column. If both x and y are 2D, they must have the same shape. If only one of them is 2D with shape (N, m) the other must have length N and will be used for every data set m. Example: >>> x = [1, 2, 3]
>>> y = np.array([[1, 2], [3, 4], [5, 6]])
>>> plot(x, y)
 is equivalent to: >>> for col in range(y.shape[1]):
...     plot(x, y[:, col])

The third way is to specify multiple sets of [x], y, [fmt] groups: >>> plot(x1, y1, 'g^', x2, y2, 'g-')
 In this case, any additional keyword argument applies to all datasets. Also this syntax cannot be combined with the data parameter.   By default, each line is assigned a different style specified by a 'style cycle'. The fmt and line property parameters are only necessary if you want explicit deviations from these defaults. Alternatively, you can also change the style cycle using rcParams["axes.prop_cycle"] (default: cycler('color', ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'])).  Parameters

x, yarray-like or scalar

The horizontal / vertical coordinates of the data points. x values are optional and default to range(len(y)). Commonly, these parameters are 1D arrays. They can also be scalars, or two-dimensional (in that case, the columns represent separate data sets). These arguments cannot be passed as keywords.
fmtstr, optional

A format string, e.g. 'ro' for red circles. See the Notes section for a full description of the format strings. Format strings are just an abbreviation for quickly setting basic line properties. All of these and more can also be controlled by keyword arguments. This argument cannot be passed as keyword.
dataindexable object, optional

An object with labelled data. If given, provide the label names to plot in x and y.  Note Technically there's a slight ambiguity in calls where the second label is a valid fmt. plot('n', 'o', data=obj) could be plt(x, y) or plt(y, fmt). In such cases, the former interpretation is chosen, but a warning is issued. You may suppress the warning by adding an empty format string plot('n', 'o', '', data=obj).     Returns
 list of Line2D

A list of lines representing the plotted data.    Other Parameters

scalex, scaleybool, default: True

These parameters determine if the view limits are adapted to the data limits. The values are passed on to autoscale_view.
**kwargsLine2D properties, optional

kwargs are used to specify properties like a line label (for auto legends), linewidth, antialiasing, marker face color. Example: >>> plot([1, 2, 3], [1, 2, 3], 'go-', label='line 1', linewidth=2)
>>> plot([1, 2, 3], [1, 4, 9], 'rs', label='line 2')
 If you specify multiple lines with one plot call, the kwargs apply to all those lines. In case the label object is iterable, each element is used as labels for each set of data. Here is a list of available Line2D properties:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color or c color
dash_capstyle CapStyle or {'butt', 'projecting', 'round'}
dash_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
dashes sequence of floats (on/off ink in points) or (None, None)
data (2, N) array or two 1D arrays
drawstyle or ds {'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'
figure Figure
fillstyle {'full', 'left', 'right', 'bottom', 'top', 'none'}
gid str
in_layout bool
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float
marker marker style string, Path or MarkerStyle
markeredgecolor or mec color
markeredgewidth or mew float
markerfacecolor or mfc color
markerfacecoloralt or mfcalt color
markersize or ms float
markevery None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool]
path_effects AbstractPathEffect
picker float or callable[[Artist, Event], tuple[bool, dict]]
pickradius float
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
solid_capstyle CapStyle or {'butt', 'projecting', 'round'}
solid_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
transform unknown
url str
visible bool
xdata 1D array
ydata 1D array
zorder float        See also  scatter

XY scatter plot with markers of varying size and/or color ( sometimes also called bubble chart).    Notes Format Strings A format string consists of a part for color, marker and line: fmt = '[marker][line][color]'
 Each of them is optional. If not provided, the value from the style cycle is used. Exception: If line is given, but no marker, the data will be a line without markers. Other combinations such as [color][marker][line] are also supported, but note that their parsing may be ambiguous. Markers
character description
'.' point marker
',' pixel marker
'o' circle marker
'v' triangle_down marker
'^' triangle_up marker
'<' triangle_left marker
'>' triangle_right marker
'1' tri_down marker
'2' tri_up marker
'3' tri_left marker
'4' tri_right marker
'8' octagon marker
's' square marker
'p' pentagon marker
'P' plus (filled) marker
'*' star marker
'h' hexagon1 marker
'H' hexagon2 marker
'+' plus marker
'x' x marker
'X' x (filled) marker
'D' diamond marker
'd' thin_diamond marker
'|' vline marker
'_' hline marker   Line Styles
character description
'-' solid line style
'--' dashed line style
'-.' dash-dot line style
':' dotted line style   Example format strings: 'b'    # blue markers with default shape
'or'   # red circles
'-g'   # green solid line
'--'   # dashed line with default color
'^k:'  # black triangle_up markers connected by a dotted line
 Colors The supported color abbreviations are the single letter codes
character color
'b' blue
'g' green
'r' red
'c' cyan
'm' magenta
'y' yellow
'k' black
'w' white   and the 'CN' colors that index into the default property cycle. If the color is the only part of the format string, you can additionally use any matplotlib.colors spec, e.g. full names ('green') or hex strings ('#008000').
  Examples using matplotlib.axes.Axes.plot

   Plotting categorical variables

   CSD Demo

   Curve with error band

   EventCollection Demo

   Fill Between and Alpha

   Filling the area between lines

   Fill Betweenx Demo

   Customizing dashed line styles

   Lines with a ticked patheffect

   Marker reference

   Markevery Demo

   prop_cycle property markevery in rcParams

   Psd Demo

   Simple Plot

   Using span_where

   Creating a timeline with lines, dates, and text

   hlines and vlines

   Contour Corner Mask

   Contour plot of irregularly spaced data

   pcolormesh grids and shading

   Streamplot

   Spectrogram Demo

   Watermark image

   Aligning Labels

   Axes box aspect

   Axes Demo

   Controlling view limits using margins and sticky_edges

   Axes Props

   axhspan Demo

   Broken Axis

   Resizing axes with constrained layout

   Resizing axes with tight layout

   Figure labels: suptitle, supxlabel, supylabel

   Invert Axes

   Secondary Axis

   Sharing axis limits and views

   Figure subfigures

   Multiple subplots

   Creating multiple subplots using plt.subplots

   Plots with different scales

   Boxplots

   Using histograms to plot a cumulative distribution

   Some features of the histogram (hist) function

   Polar plot

   Polar Legend

   Using accented text in matplotlib

   Scale invariant angle label

   Annotating Plots

   Composing Custom Legends

   Date tick labels

   Custom tick formatter for time series

   AnnotationBbox demo

   Labeling ticks using engineering notation

   Annotation arrow style reference

   Legend using pre-defined labels

   Legend Demo

   Mathtext

   Math fontfamily

   Multiline

   Rendering math equations using TeX

   Text Rotation Relative To Line

   Title positioning

   Text watermark

   Annotate Transform

   Annotating a plot

   Annotation Polar

   Programmatically controlling subplot adjustment

   Dollar Ticks

   Simple axes labels

   Text Commands

   Color Demo

   Color by y-value

   PathPatch object

   Bezier Curve

   Dark background style sheet

   FiveThirtyEight style sheet

   ggplot style sheet

   Axes with a fixed physical size

   Parasite Simple

   Simple Axisline4

   Axis line styles

   Parasite Axes demo

   Parasite axis demo

   Custom spines with axisartist

   Simple Axisline

   Anatomy of a figure

   Bachelor's degrees by gender

   Integral as the area under a curve

   XKCD

   Decay

   The Bayes update

   The double pendulum problem

   Animated 3D random walk

   Animated line plot

   MATPLOTLIB UNCHAINED

   Mouse move and click events

   Data Browser

   Keypress event

   Legend Picking

   Looking Glass

   Path Editor

   Pick Event Demo2

   Resampling Data

   Timers

   Frontpage histogram example

   Frontpage plot example

   Changing colors of lines intersecting a box

   Cross hair cursor

   Custom projection

   Patheffect Demo

   Pythonic Matplotlib

   SVG Filter Line

   TickedStroke patheffect

   Zorder Demo

   Plot 2D data on 3D plot

   3D box surface plot

   Parametric Curve

   Lorenz Attractor

   2D and 3D Axes in same Figure

   Loglog Aspect

   Scales

   Symlog Demo

   Anscombe's quartet

   Radar chart (aka spider or star chart)

   Centered spines with arrows

   Multiple Yaxis With Spines

   Spine Placement

   Spines

   Custom spine bounds

   Centering labels between ticks

   Formatting date ticks using ConciseDateFormatter

   Date Demo Convert

   Date Index Formatter

   Date Precision and Epochs

   Major and minor ticks

   The default tick formatter

   Set default y-axis tick labels on the right

   Setting tick labels from a list of values

   Set default x-axis tick labels on the top

   Evans test

   CanvasAgg demo

   Annotate Explain

   Connect Simple01

   Connection styles for annotations

   Nested GridSpecs

   Pgf Fonts

   Pgf Texsystem

   Simple Annotate01

   Simple Legend01

   Simple Legend02

   Annotated Cursor

   Check Buttons

   Cursor

   Multicursor

   Radio Buttons

   Rectangle and ellipse selectors

   Span Selector

   Textbox

   Basic Usage

   Artist tutorial

   Legend guide

   Styling with cycler

   Constrained Layout Guide

   Tight Layout guide

   Arranging multiple Axes in a Figure

   Autoscaling

   Faster rendering by using blitting

   Path Tutorial

   Transformations Tutorial

   Specifying Colors

   Text in Matplotlib Plots

   plot(x, y)

   fill_between(x, y1, y2)

   tricontour(x, y, z)

   tricontourf(x, y, z)

   tripcolor(x, y, z)


matplotlib.axes.Axes.plot_date   Axes.plot_date(x, y, fmt='o', tz=None, xdate=True, ydate=False, *, data=None, **kwargs)[source]

Plot coercing the axis to treat floats as dates.  Discouraged This method exists for historic reasons and will be deprecated in the future.
datetime-like data should directly be plotted using plot. If you need to plot plain numeric data as Matplotlib date format or need to set a timezone, call ax.xaxis.axis_date / ax.yaxis.axis_date before plot. See Axis.axis_date.   Similar to plot, this plots y vs. x as lines or markers. However, the axis labels are formatted as dates depending on xdate and ydate. Note that plot will work with datetime and numpy.datetime64 objects without resorting to this method.  Parameters

x, yarray-like

The coordinates of the data points. If xdate or ydate is True, the respective values x or y are interpreted as Matplotlib dates.
fmtstr, optional

The plot format string. For details, see the corresponding parameter in plot.
tztimezone string or datetime.tzinfo, default: rcParams["timezone"] (default: 'UTC')

The time zone to use in labeling dates.
xdatebool, default: True

If True, the x-axis will be interpreted as Matplotlib dates.
ydatebool, default: False

If True, the y-axis will be interpreted as Matplotlib dates.    Returns
 list of Line2D

Objects representing the plotted data.    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, y  **kwargs

Keyword arguments control the Line2D properties:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color or c color
dash_capstyle CapStyle or {'butt', 'projecting', 'round'}
dash_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
dashes sequence of floats (on/off ink in points) or (None, None)
data (2, N) array or two 1D arrays
drawstyle or ds {'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'
figure Figure
fillstyle {'full', 'left', 'right', 'bottom', 'top', 'none'}
gid str
in_layout bool
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float
marker marker style string, Path or MarkerStyle
markeredgecolor or mec color
markeredgewidth or mew float
markerfacecolor or mfc color
markerfacecoloralt or mfcalt color
markersize or ms float
markevery None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool]
path_effects AbstractPathEffect
picker float or callable[[Artist, Event], tuple[bool, dict]]
pickradius float
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
solid_capstyle CapStyle or {'butt', 'projecting', 'round'}
solid_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
transform unknown
url str
visible bool
xdata 1D array
ydata 1D array
zorder float        See also  matplotlib.dates

Helper functions on dates.  matplotlib.dates.date2num

Convert dates to num.  matplotlib.dates.num2date

Convert num to dates.  matplotlib.dates.drange

Create an equally spaced sequence of dates.    Notes If you are using custom date tickers and formatters, it may be necessary to set the formatters/locators after the call to plot_date. plot_date will set the default tick locator to AutoDateLocator (if the tick locator is not already set to a DateLocator instance) and the default tick formatter to AutoDateFormatter (if the tick formatter is not already set to a DateFormatter instance).


matplotlib.axes.Axes.psd   Axes.psd(x, NFFT=None, Fs=None, Fc=None, detrend=None, window=None, noverlap=None, pad_to=None, sides=None, scale_by_freq=None, return_line=None, *, data=None, **kwargs)[source]

Plot the power spectral density. The power spectral density \(P_{xx}\) by Welch's average periodogram method. The vector x is divided into NFFT length segments. Each segment is detrended by function detrend and windowed by function window. noverlap gives the length of the overlap between segments. The \(|\mathrm{fft}(i)|^2\) of each segment \(i\) are averaged to compute \(P_{xx}\), with a scaling to correct for power loss due to windowing. If len(x) < NFFT, it will be zero padded to NFFT.  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.
noverlapint, default: 0 (no overlap)

The number of points of overlap between segments.
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.
return_linebool, default: False

Whether to include the line object plotted in the returned values.    Returns

Pxx1-D array

The values for the power spectrum \(P_{xx}\) before scaling (real valued).
freqs1-D array

The frequencies corresponding to the elements in Pxx.
lineLine2D

The line created by this function. Only returned if return_line is True.    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  **kwargs

Keyword arguments control the Line2D properties:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color or c color
dash_capstyle CapStyle or {'butt', 'projecting', 'round'}
dash_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
dashes sequence of floats (on/off ink in points) or (None, None)
data (2, N) array or two 1D arrays
drawstyle or ds {'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'
figure Figure
fillstyle {'full', 'left', 'right', 'bottom', 'top', 'none'}
gid str
in_layout bool
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float
marker marker style string, Path or MarkerStyle
markeredgecolor or mec color
markeredgewidth or mew float
markerfacecolor or mfc color
markerfacecoloralt or mfcalt color
markersize or ms float
markevery None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool]
path_effects AbstractPathEffect
picker float or callable[[Artist, Event], tuple[bool, dict]]
pickradius float
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
solid_capstyle CapStyle or {'butt', 'projecting', 'round'}
solid_joinstyle JoinStyle or {'miter', 'round', 'bevel'}
transform unknown
url str
visible bool
xdata 1D array
ydata 1D array
zorder float        See also  specgram

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

Plots the magnitude spectrum.  csd

Plots the spectral density between two signals.    Notes For plotting, the power is plotted as \(10\log_{10}(P_{xx})\) for decibels, though Pxx itself is returned. References Bendat & Piersol -- Random Data: Analysis and Measurement Procedures, John Wiley & Sons (1986)
  Examples using matplotlib.axes.Axes.psd

   Psd Demo


matplotlib.axes.Axes.quiver   Axes.quiver(*args, data=None, **kwargs)[source]

Plot a 2D field of arrows. Call signature: quiver([X, Y], U, V, [C], **kw)
 X, Y define the arrow locations, U, V define the arrow directions, and C optionally sets the color. Each arrow is internally represented by a filled polygon with a default edge linewidth of 0. As a result, an arrow is rather a filled area, not a line with a head, and PolyCollection properties like linewidth, linestyle, facecolor, etc. act accordingly. Arrow size The default settings auto-scales the length of the arrows to a reasonable size. To change this behavior see the scale and scale_units parameters. Arrow shape The defaults give a slightly swept-back arrow; to make the head a triangle, make headaxislength the same as headlength. To make the arrow more pointed, reduce headwidth or increase headlength and headaxislength. To make the head smaller relative to the shaft, scale down all the head parameters. You will probably do best to leave minshaft alone. Arrow outline linewidths and edgecolors can be used to customize the arrow outlines.  Parameters

X, Y1D or 2D array-like, optional

The x and y coordinates of the arrow locations. If not given, they will be generated as a uniform integer meshgrid based on the dimensions of U and V. If X and Y are 1D but U, V are 2D, X, Y are expanded to 2D using X, Y = np.meshgrid(X, Y). In this case len(X) and len(Y) must match the column and row dimensions of U and V.
U, V1D or 2D array-like

The x and y direction components of the arrow vectors. They must have the same number of elements, matching the number of arrow locations. U and V may be masked. Only locations unmasked in U, V, and C will be drawn.
C1D or 2D array-like, optional

Numeric data that defines the arrow colors by colormapping via norm and cmap. This does not support explicit colors. If you want to set colors directly, use color instead. The size of C must match the number of arrow locations.
units{'width', 'height', 'dots', 'inches', 'x', 'y', 'xy'}, default: 'width'

The arrow dimensions (except for length) are measured in multiples of this unit. The following values are supported:  'width', 'height': The width or height of the axis. 'dots', 'inches': Pixels or inches based on the figure dpi. 'x', 'y', 'xy': X, Y or \(\sqrt{X^2 + Y^2}\) in data units.  The arrows scale differently depending on the units. For 'x' or 'y', the arrows get larger as one zooms in; for other units, the arrow size is independent of the zoom state. For 'width or 'height', the arrow size increases with the width and height of the axes, respectively, when the window is resized; for 'dots' or 'inches', resizing does not change the arrows.
angles{'uv', 'xy'} or array-like, default: 'uv'

Method for determining the angle of the arrows.
'uv': The arrow axis aspect ratio is 1 so that if U == V the orientation of the arrow on the plot is 45 degrees counter-clockwise from the horizontal axis (positive to the right). Use this if the arrows symbolize a quantity that is not based on X, Y data coordinates.  'xy': Arrows point from (x, y) to (x+u, y+v). Use this for plotting a gradient field, for example.
Alternatively, arbitrary angles may be specified explicitly as an array of values in degrees, counter-clockwise from the horizontal axis. In this case U, V is only used to determine the length of the arrows.   Note: inverting a data axis will correspondingly invert the arrows only with angles='xy'.
scalefloat, optional

Number of data units per arrow length unit, e.g., m/s per plot width; a smaller scale parameter makes the arrow longer. Default is None. If None, a simple autoscaling algorithm is used, based on the average vector length and the number of vectors. The arrow length unit is given by the scale_units parameter.
scale_units{'width', 'height', 'dots', 'inches', 'x', 'y', 'xy'}, optional

If the scale kwarg is None, the arrow length unit. Default is None. e.g. scale_units is 'inches', scale is 2.0, and (u, v) = (1, 0), then the vector will be 0.5 inches long. If scale_units is 'width' or 'height', then the vector will be half the width/height of the axes. If scale_units is 'x' then the vector will be 0.5 x-axis units. To plot vectors in the x-y plane, with u and v having the same units as x and y, use angles='xy', scale_units='xy', scale=1.
widthfloat, optional

Shaft width in arrow units; default depends on choice of units, above, and number of vectors; a typical starting value is about 0.005 times the width of the plot.
headwidthfloat, default: 3

Head width as multiple of shaft width.
headlengthfloat, default: 5

Head length as multiple of shaft width.
headaxislengthfloat, default: 4.5

Head length at shaft intersection.
minshaftfloat, default: 1

Length below which arrow scales, in units of head length. Do not set this to less than 1, or small arrows will look terrible!
minlengthfloat, default: 1

Minimum length as a multiple of shaft width; if an arrow length is less than this, plot a dot (hexagon) of this diameter instead.
pivot{'tail', 'mid', 'middle', 'tip'}, default: 'tail'

The part of the arrow that is anchored to the X, Y grid. The arrow rotates about this point. 'mid' is a synonym for 'middle'.
colorcolor or color sequence, optional

Explicit color(s) for the arrows. If C has been set, color has no effect. This is a synonym for the PolyCollection facecolor parameter.    Returns
 Quiver
  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).
**kwargsPolyCollection properties, optional

All other keyword arguments are passed on to PolyCollection:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha array-like or scalar or None
animated bool
antialiased or aa or antialiaseds bool or list of bools
array array-like or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clim (vmin: float, vmax: float)
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
cmap Colormap or str or None
color color or list of rgba tuples
edgecolor or ec or edgecolors color or list of colors or 'face'
facecolor or facecolors or fc color or list of colors
figure Figure
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or dashes or linestyles or ls str or tuple or list thereof
linewidth or linewidths or lw float or list of floats
norm Normalize or None
offset_transform Transform
offsets (N, 2) or (2,) array-like
path_effects AbstractPathEffect
paths list of array-like
picker None or bool or float or callable
pickradius float
rasterized bool
sizes ndarray or None
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
urls list of str or None
verts list of array-like
verts_and_codes unknown
visible bool
zorder float        See also  Axes.quiverkey

Add a key to a quiver plot.
  Examples using matplotlib.axes.Axes.quiver

   Advanced quiver and quiverkey functions

   Quiver Simple Demo

   Trigradient Demo

   3D quiver plot

   quiver(X, Y, U, V)


matplotlib.axes.Axes.quiverkey   Axes.quiverkey(Q, X, Y, U, label, **kwargs)[source]

Add a key to a quiver plot. The positioning of the key depends on X, Y, coordinates, and labelpos. If labelpos is 'N' or 'S', X, Y give the position of the middle of the key arrow. If labelpos is 'E', X, Y positions the head, and if labelpos is 'W', X, Y positions the tail; in either of these two cases, X, Y is somewhere in the middle of the arrow+label key object.  Parameters

Qmatplotlib.quiver.Quiver

A Quiver object as returned by a call to quiver().
X, Yfloat

The location of the key.
Ufloat

The length of the key.
labelstr

The key label (e.g., length and units of the key).
anglefloat, default: 0

The angle of the key arrow, in degrees anti-clockwise from the x-axis.
coordinates{'axes', 'figure', 'data', 'inches'}, default: 'axes'

Coordinate system and units for X, Y: 'axes' and 'figure' are normalized coordinate systems with (0, 0) in the lower left and (1, 1) in the upper right; 'data' are the axes data coordinates (used for the locations of the vectors in the quiver plot itself); 'inches' is position in the figure in inches, with (0, 0) at the lower left corner.
colorcolor

Overrides face and edge colors from Q.
labelpos{'N', 'S', 'E', 'W'}

Position the label above, below, to the right, to the left of the arrow, respectively.
labelsepfloat, default: 0.1

Distance in inches between the arrow and the label.
labelcolorcolor, default: rcParams["text.color"] (default: 'black')

Label color.
fontpropertiesdict, optional

A dictionary with keyword arguments accepted by the FontProperties initializer: family, style, variant, size, weight.  **kwargs

Any additional keyword arguments are used to override vector properties taken from Q.
  Examples using matplotlib.axes.Axes.quiverkey

   Advanced quiver and quiverkey functions

   Quiver Simple Demo


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

Efficiently redraw Axes data, but not axis ticks, labels, etc. This method can only be used after an initial draw which caches the renderer.


matplotlib.axes.Axes.relim   Axes.relim(visible_only=False)[source]

Recompute the data limits based on current artists. At present, Collection instances are not supported.  Parameters

visible_onlybool, default: False

Whether to exclude invisible artists.
  Examples using matplotlib.axes.Axes.relim

   Packed-bubble chart

   Textbox


matplotlib.axes.Axes.remove_callback   Axes.remove_callback(oid)[source]

Remove a callback based on its observer id.  See also  add_callback


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

Reset the active position to the original position. This resets the a possible position change due to aspect constraints. For an explanation of the positions see set_position.


matplotlib.axes.Axes.scatter   Axes.scatter(x, y, s=None, c=None, marker=None, cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, *, edgecolors=None, plotnonfinite=False, data=None, **kwargs)[source]

A scatter plot of y vs. x with varying marker size and/or color.  Parameters

x, yfloat or array-like, shape (n, )

The data positions.
sfloat or array-like, shape (n, ), optional

The marker size in points**2. Default is rcParams['lines.markersize'] ** 2.
carray-like or list of colors or color, optional

The marker colors. Possible values:  A scalar or sequence of n numbers to be mapped to colors using cmap and norm. A 2D array in which the rows are RGB or RGBA. A sequence of colors of length n. A single color format string.  Note that c should not be a single numeric RGB or RGBA sequence because that is indistinguishable from an array of values to be colormapped. If you want to specify the same RGB or RGBA value for all points, use a 2D array with a single row. Otherwise, value- matching will have precedence in case of a size matching with x and y. If you wish to specify a single color for all points prefer the color keyword argument. Defaults to None. In that case the marker color is determined by the value of color, facecolor or facecolors. In case those are not specified or None, the marker color is determined by the next color of the Axes' current "shape and fill" color cycle. This cycle defaults to rcParams["axes.prop_cycle"] (default: cycler('color', ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'])).
markerMarkerStyle, default: rcParams["scatter.marker"] (default: 'o')

The marker style. marker can be either an instance of the class or the text shorthand for a particular marker. See matplotlib.markers for more information about marker styles.
cmapstr or Colormap, default: rcParams["image.cmap"] (default: 'viridis')

A Colormap instance or registered colormap name. cmap is only used if c is an array of floats.
normNormalize, default: None

If c is an array of floats, norm is used to scale the color data, c, in the range 0 to 1, in order to map into the colormap cmap. If None, use the default colors.Normalize.
vmin, vmaxfloat, default: None

vmin and vmax are used in conjunction with the default norm to map the color array c to the colormap cmap. If None, the respective min and max of the color array is used. It is an error to use vmin/vmax when norm is given.
alphafloat, default: None

The alpha blending value, between 0 (transparent) and 1 (opaque).
linewidthsfloat or array-like, default: rcParams["lines.linewidth"] (default: 1.5)

The linewidth of the marker edges. Note: The default edgecolors is 'face'. You may want to change this as well.
edgecolors{'face', 'none', None} or color or sequence of color, default: rcParams["scatter.edgecolors"] (default: 'face')

The edge color of the marker. Possible values:  'face': The edge color will always be the same as the face color. 'none': No patch boundary will be drawn. A color or sequence of colors.  For non-filled markers, edgecolors is ignored. Instead, the color is determined like with 'face', i.e. from c, colors, or facecolors.
plotnonfinitebool, default: False

Whether to plot points with nonfinite c (i.e. inf, -inf or nan). If True the points are drawn with the bad colormap color (see Colormap.set_bad).    Returns
 PathCollection
  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, y, s, linewidths, edgecolors, c, facecolor, facecolors, color
**kwargsCollection properties

    See also  plot

To plot scatter plots when markers are identical in size and color.    Notes  The plot function will be faster for scatterplots where markers don't vary in size or color. Any or all of x, y, s, and c may be masked arrays, in which case all masks will be combined and only unmasked points will be plotted. Fundamentally, scatter works with 1D arrays; x, y, s, and c may be input as N-D arrays, but within scatter they will be flattened. The exception is c, which will be flattened only if its size matches the size of x and y.
  Examples using matplotlib.axes.Axes.scatter

   Scatter Custom Symbol

   Scatter Demo2

   Scatter plot with histograms

   Scatter plot with pie chart markers

   Scatter plots with a legend

   Advanced quiver and quiverkey functions

   Axes box aspect

   Axis Label Position

   Plot a confidence ellipse of a two-dimensional dataset

   Violin plot customization

   Scatter plot on polar axis

   Legend Demo

   Scatter Histogram (Locatable Axes)

   mpl_toolkits.axisartist.floating_axes features

   Rain simulation

   Zoom Window

   Plotting with keywords

   Zorder Demo

   Plot 2D data on 3D plot

   3D scatterplot

   Automatically setting tick positions

   Unit handling

   Annotate Text Arrow

   Polygon Selector

   Basic Usage

   Choosing Colormaps in Matplotlib

   scatter(x, y)


matplotlib.axes.Axes.secondary_xaxis   Axes.secondary_xaxis(location, *, functions=None, **kwargs)[source]

Add a second x-axis to this Axes. For example if we want to have a second scale for the data plotted on the xaxis.  Parameters

location{'top', 'bottom', 'left', 'right'} or float

The position to put the secondary axis. Strings can be 'top' or 'bottom' for orientation='x' and 'right' or 'left' for orientation='y'. A float indicates the relative position on the parent axes to put the new axes, 0.0 being the bottom (or left) and 1.0 being the top (or right).
functions2-tuple of func, or Transform with an inverse

If a 2-tuple of functions, the user specifies the transform function and its inverse. i.e. functions=(lambda x: 2 / x, lambda x: 2 / x) would be an reciprocal transform with a factor of 2. The user can also directly supply a subclass of transforms.Transform so long as it has an inverse. See Secondary Axis for examples of making these conversions.    Returns

axaxes._secondary_axes.SecondaryAxis

  Other Parameters

**kwargsAxes properties.

Other miscellaneous axes parameters.      Warning This method is experimental as of 3.1, and the API may change.  Examples The main axis shows frequency, and the secondary axis shows period. (Source code, png, pdf)
  Examples using matplotlib.axes.Axes.secondary_xaxis

   Secondary Axis

   Basic Usage


matplotlib.axes.Axes.secondary_yaxis   Axes.secondary_yaxis(location, *, functions=None, **kwargs)[source]

Add a second y-axis to this Axes. For example if we want to have a second scale for the data plotted on the yaxis.  Parameters

location{'top', 'bottom', 'left', 'right'} or float

The position to put the secondary axis. Strings can be 'top' or 'bottom' for orientation='x' and 'right' or 'left' for orientation='y'. A float indicates the relative position on the parent axes to put the new axes, 0.0 being the bottom (or left) and 1.0 being the top (or right).
functions2-tuple of func, or Transform with an inverse

If a 2-tuple of functions, the user specifies the transform function and its inverse. i.e. functions=(lambda x: 2 / x, lambda x: 2 / x) would be an reciprocal transform with a factor of 2. The user can also directly supply a subclass of transforms.Transform so long as it has an inverse. See Secondary Axis for examples of making these conversions.    Returns

axaxes._secondary_axes.SecondaryAxis

  Other Parameters

**kwargsAxes properties.

Other miscellaneous axes parameters.      Warning This method is experimental as of 3.1, and the API may change.  Examples Add a secondary Axes that converts from radians to degrees (Source code, png, pdf)
  Examples using matplotlib.axes.Axes.secondary_yaxis

   Secondary Axis


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

Make a plot with log scaling on the x axis. Call signatures: semilogx([x], y, [fmt], data=None, **kwargs)
semilogx([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)
 This is just a thin wrapper around plot which additionally changes the x-axis to log scaling. All of the concepts and parameters of plot can be used here as well. The additional parameters base, subs, and nonpositive control the x-axis properties. They are just forwarded to Axes.set_xscale.  Parameters

basefloat, default: 10

Base of the x logarithm.
subsarray-like, optional

The location of the minor xticks. If None, reasonable locations are automatically chosen depending on the number of decades in the plot. See Axes.set_xscale for details.
nonpositive{'mask', 'clip'}, default: 'mask'

Non-positive values in x can be masked as invalid, or clipped to a very small positive number.  **kwargs

All parameters supported by plot.    Returns
 list of Line2D

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

   Log Demo

   Log Axis

   Transformations Tutorial


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

Make a plot with log scaling on the y axis. Call signatures: semilogy([x], y, [fmt], data=None, **kwargs)
semilogy([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)
 This is just a thin wrapper around plot which additionally changes the y-axis to log scaling. All of the concepts and parameters of plot can be used here as well. The additional parameters base, subs, and nonpositive control the y-axis properties. They are just forwarded to Axes.set_yscale.  Parameters

basefloat, default: 10

Base of the y logarithm.
subsarray-like, optional

The location of the minor yticks. If None, reasonable locations are automatically chosen depending on the number of decades in the plot. See Axes.set_yscale for details.
nonpositive{'mask', 'clip'}, default: 'mask'

Non-positive values in y can be masked as invalid, or clipped to a very small positive number.  **kwargs

All parameters supported by plot.    Returns
 list of Line2D

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

   Log Demo

   SkewT-logP diagram: using transforms and custom projections


matplotlib.axes.Axes.set   Axes.set(*, adjustable=<UNSET>, agg_filter=<UNSET>, alpha=<UNSET>, anchor=<UNSET>, animated=<UNSET>, aspect=<UNSET>, autoscale_on=<UNSET>, autoscalex_on=<UNSET>, autoscaley_on=<UNSET>, axes_locator=<UNSET>, axisbelow=<UNSET>, box_aspect=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, facecolor=<UNSET>, frame_on=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, navigate=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, position=<UNSET>, prop_cycle=<UNSET>, rasterization_zorder=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, title=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, xbound=<UNSET>, xlabel=<UNSET>, xlim=<UNSET>, xmargin=<UNSET>, xscale=<UNSET>, xticklabels=<UNSET>, xticks=<UNSET>, ybound=<UNSET>, ylabel=<UNSET>, ylim=<UNSET>, ymargin=<UNSET>, yscale=<UNSET>, yticklabels=<UNSET>, yticks=<UNSET>, zorder=<UNSET>)[source]

Set multiple properties at once. Supported properties are
Property Description
adjustable {'box', 'datalim'}
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
anchor (float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', ...}
animated bool
aspect {'auto', 'equal'} or float
autoscale_on bool
autoscalex_on bool
autoscaley_on bool
axes_locator Callable[[Axes, Renderer], Bbox]
axisbelow bool or 'line'
box_aspect float or None
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
facecolor or fc color
figure Figure
frame_on bool
gid str
in_layout bool
label object
navigate bool
navigate_mode unknown
path_effects AbstractPathEffect
picker None or bool or float or callable
position [left, bottom, width, height] or Bbox
prop_cycle unknown
rasterization_zorder float or None
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
title str
transform Transform
url str
visible bool
xbound unknown
xlabel str
xlim (bottom: float, top: float)
xmargin float greater than -0.5
xscale {"linear", "log", "symlog", "logit", ...} or ScaleBase
xticklabels unknown
xticks unknown
ybound unknown
ylabel str
ylim (bottom: float, top: float)
ymargin float greater than -0.5
yscale {"linear", "log", "symlog", "logit", ...} or ScaleBase
yticklabels unknown
yticks unknown
zorder float
  Examples using matplotlib.axes.Axes.set

   Curve with error band

   Bar chart with gradients

   Simple Plot

   Creating a timeline with lines, dates, and text

   Contour plot of irregularly spaced data

   Streamplot

   Axes Demo

   Creating multiple subplots using plt.subplots

   Boxplots

   Hexagonal binned plot

   Nested pie charts

   Annotating Plots

   Arrow Demo

   Usetex Baseline Test

   Text Commands

   Drawing fancy boxes

   Adding a colorbar to inset axes

   Inset Locator Demo

   Animated 3D random walk

   Zoom Window

   Manual Contour

   Plotting with keywords

   3D box surface plot

   Projecting contour profiles onto a graph

   Projecting filled contour onto a graph

   Generate polygons to fill under 3D line graph

   3D stem

   3D voxel / volumetric plot with rgb colors

   Log Demo

   Annotate Explain

   Connection styles for annotations

   Nested GridSpecs

   Simple Annotate01

   Mouse Cursor

   The Lifecycle of a Plot

   Arranging multiple Axes in a Figure

   plot(x, y)

   scatter(x, y)

   bar(x, height) / barh(y, width)

   stem(x, y)

   step(x, y)

   fill_between(x, y1, y2)

   barbs(X, Y, U, V)

   quiver(X, Y, U, V)

   hist(x)

   boxplot(X)

   errorbar(x, y, yerr, xerr)

   violinplot(D)

   eventplot(D)

   hist2d(x, y)

   hexbin(x, y, C)

   pie(x)

   tricontour(x, y, z)

   tricontourf(x, y, z)

   tripcolor(x, y, z)

   triplot(x, y)


matplotlib.axes.Axes.set_adjustable   Axes.set_adjustable(adjustable, share=False)[source]

Set how the Axes adjusts to achieve the required aspect ratio.  Parameters

adjustable{'box', 'datalim'}

If 'box', change the physical dimensions of the Axes. If 'datalim', change the x or y data limits.
sharebool, default: False

If True, apply the settings to all shared Axes.      See also  matplotlib.axes.Axes.set_aspect

For a description of aspect handling.    Notes Shared Axes (of which twinned Axes are a special case) impose restrictions on how aspect ratios can be imposed. For twinned Axes, use 'datalim'. For Axes that share both x and y, use 'box'. Otherwise, either 'datalim' or 'box' may be used. These limitations are partly a requirement to avoid over-specification, and partly a result of the particular implementation we are currently using, in which the adjustments for aspect ratios are done sequentially and independently on each Axes as it is drawn.
  Examples using matplotlib.axes.Axes.set_adjustable

   Loglog Aspect


matplotlib.axes.Axes.set_anchor   Axes.set_anchor(anchor, share=False)[source]

Define the anchor location. The actual drawing area (active position) of the Axes may be smaller than the Bbox (original position) when a fixed aspect is required. The anchor defines where the drawing area will be located within the available space.  Parameters

anchor(float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', ...}

Either an (x, y) pair of relative coordinates (0 is left or bottom, 1 is right or top), 'C' (center), or a cardinal direction ('SW', southwest, is bottom left, etc.). str inputs are shorthands for (x, y) coordinates, as shown in the following table: .. code-block:: none

'NW' (0.0, 1.0) 'N' (0.5, 1.0) 'NE' (1.0, 1.0)
'W' (0.0, 0.5) 'C' (0.5, 0.5) 'E' (1.0, 0.5)
'SW' (0.0, 0.0) 'S' (0.5, 0.0) 'SE' (1.0, 0.0)
sharebool, default: False

If True, apply the settings to all shared Axes.      See also  matplotlib.axes.Axes.set_aspect

for a description of aspect handling.


matplotlib.axes.Axes.set_aspect   Axes.set_aspect(aspect, adjustable=None, anchor=None, share=False)[source]

Set the aspect ratio of the axes scaling, i.e. y/x-scale.  Parameters

aspect{'auto', 'equal'} or float

Possible values:  'auto': fill the position rectangle with data. 'equal': same as aspect=1, i.e. same scaling for x and y.
float: The displayed size of 1 unit in y-data coordinates will be aspect times the displayed size of 1 unit in x-data coordinates; e.g. for aspect=2 a square in data coordinates will be rendered with a height of twice its width.
adjustableNone or {'box', 'datalim'}, optional

If not None, this defines which parameter will be adjusted to meet the required aspect. See set_adjustable for further details.
anchorNone or str or (float, float), optional

If not None, this defines where the Axes will be drawn if there is extra space due to aspect constraints. The most common way to to specify the anchor are abbreviations of cardinal directions:
value description
'C' centered
'SW' lower left corner
'S' middle of bottom edge
'SE' lower right corner
etc.    See set_anchor for further details.
sharebool, default: False

If True, apply the settings to all shared Axes.      See also  matplotlib.axes.Axes.set_adjustable

Set how the Axes adjusts to achieve the required aspect ratio.  matplotlib.axes.Axes.set_anchor

Set the position in case of extra space.
  Examples using matplotlib.axes.Axes.set_aspect

   Bar chart with gradients

   Streamplot

   Tricontour Demo

   Tricontour Smooth Delaunay

   Tricontour Smooth User

   Trigradient Demo

   Tripcolor Demo

   Triplot Demo

   Axes box aspect

   Controlling view limits using margins and sticky_edges

   Placing Colorbars

   Multiline

   Mmh Donuts!!!

   Inset Locator Demo2

   Scatter Histogram (Locatable Axes)

   Simple Anchored Artists

   axis_direction demo

   Simple Axis Pad

   The double pendulum problem

   Anchored Artists

   Rasterization for vector graphics

   Loglog Aspect

   Annotate Text Arrow

   Transformations Tutorial

   Colormap Normalization


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

Set whether autoscaling is applied to each axis on the next draw or call to Axes.autoscale_view.  Parameters

bbool

  Examples using matplotlib.axes.Axes.set_autoscale_on

   Resampling Data


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

Set whether the x-axis is autoscaled on the next draw or call to Axes.autoscale_view.  Parameters

bbool


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

Set whether the y-axis is autoscaled on the next draw or call to Axes.autoscale_view.  Parameters

bbool


matplotlib.axes.Axes.set_axes_locator   Axes.set_axes_locator(locator)[source]

Set the Axes locator.  Parameters

locatorCallable[[Axes, Renderer], Bbox]

  Examples using matplotlib.axes.Axes.set_axes_locator

   HBoxDivider demo


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

Turn the x- and y-axis off. This affects the axis lines, ticks, ticklabels, grid and axis labels.
  Examples using matplotlib.axes.Axes.set_axis_off

   Marker reference

   Barcode

   Blend transparency with color in 2D images

   Nested pie charts

   Annotation arrow style reference

   Precise text layout

   Drawing fancy boxes

   Choosing Colormaps in Matplotlib

   Text properties and layout


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

Turn the x- and y-axis on. This affects the axis lines, ticks, ticklabels, grid and axis labels.


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

Set whether axis ticks and gridlines are above or below most artists. This controls the zorder of the ticks and gridlines. For more information on the zorder see Zorder Demo.  Parameters

bbool or 'line'

Possible values:
True (zorder = 0.5): Ticks and gridlines are below all Artists. 'line' (zorder = 1.5): Ticks and gridlines are above patches (e.g. rectangles, with default zorder = 1) but still below lines and markers (with their default zorder = 2).
False (zorder = 2.5): Ticks and gridlines are above patches and lines / markers.       See also  get_axisbelow