A legend handler that shows numpoints in the legend, and allows them to be individually offset in the y-direction.
Number of points to show in legend entry.
Length numpoints list of y offsets for each point in legend entry.
Keyword arguments forwarded to HandlerNpoints.


Handler for Patch instances.
The function that creates the legend key artist. patch_func should have the signature:
Subsequently the created artist will have its update_prop method called and the appropriate transform will be applied.
Keyword arguments forwarded to HandlerBase.


Handler for PathCollections, which are used by scatter.
Number of points to show in legend entry.
Length numpoints list of y offsets for each point in legend entry.
Keyword arguments forwarded to HandlerNpoints.


Handler for PolyCollection used in fill_between and stackplot.


Handler for RegularPolyCollections.
Number of points to show in legend entry.
Length numpoints list of y offsets for each point in legend entry.
Keyword arguments forwarded to HandlerNpoints.


Handler for plots produced by stem.
Padding between points in legend entry.
Number of points to show in legend entry.
Length numpoints list of y offsets for each point in legend entry.
Keyword arguments forwarded to HandlerNpointsYoffsets.


Handler for Tuple.
The number of sections to divide the legend area into. If None, use the length of the input tuple.
Padding in units of fraction of font size.
Keyword arguments forwarded to HandlerBase.


2D lines with support for a variety of line styles, markers, colors, etc.
Line2D(xdata, ydata[, linewidth, linestyle, ...])
A line - the line can have both a solid linestyle connecting all the vertices, and a marker at each vertex.
VertexSelector(line)
Manage the callbacks to maintain a list of selected vertices for Line2D.
segment_hits(cx, cy, x, y, radius)
Return the indices of the segments in the polyline with coordinates (cx, cy) that are within a distance radius of the point (x, y).


Bases: matplotlib.artist.Artist
A line - the line can have both a solid linestyle connecting all the vertices, and a marker at each vertex. Additionally, the drawing of the solid line is influenced by the drawstyle, e.g., one can create "stepped" lines in various styles.
Create a Line2D instance with x and y data in sequences of xdata, ydata.
Additional keyword arguments are Line2D properties:
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
scalar or None
animated
bool
antialiased or aa
bool
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
color or c
color
dash_capstyle
CapStyle or {'butt', 'projecting', 'round'}
dash_joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
dashes
sequence of floats (on/off ink in points) or (None, None)
data
(2, N) array or two 1D arrays
drawstyle or ds
{'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'
figure
Figure
fillstyle
{'full', 'left', 'right', 'bottom', 'top', 'none'}
gid
str
in_layout
bool
label
object
linestyle or ls
{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw
float
marker
marker style string, Path or MarkerStyle
markeredgecolor or mec
color
markeredgewidth or mew
float
markerfacecolor or mfc
color
markerfacecoloralt or mfcalt
color
markersize or ms
float
markevery
None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool]
path_effects
AbstractPathEffect
picker
float or callable[[Artist, Event], tuple[bool, dict]]
pickradius
float
rasterized
bool
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
solid_capstyle
CapStyle or {'butt', 'projecting', 'round'}
solid_joinstyle
JoinStyle or {'miter', 'round', 'bevel'}
transform
unknown
url
str
visible
bool
xdata
1D array
ydata
1D array
zorder
float
See set_linestyle() for a description of the line styles, set_marker() for a description of the markers, and set_drawstyle() for a description of the draw styles.
Test whether mouseevent occurred on the line.
An event is deemed to have occurred "on" the line if it is less than self.pickradius (default: 5 points) away from it. Use get_pickradius or set_pickradius to get or set the pick radius.
Whether any values are within the radius.
A dictionary {'ind': pointlist}, where pointlist is a list of points of the line that are within the pickradius around the event position.
TODO: sort returned indices by distance
Draw the Artist (and its children) using the given renderer.
This has no effect if the artist is not visible (Artist.get_visible returns False).
This method is overridden in the Artist subclasses.
Alias for get_antialiased.
Return whether antialiased rendering is used.
Alias for get_color.
Return the line color.
See also set_color.
Return the CapStyle for dashed lines.
See also set_dash_capstyle.
Return the JoinStyle for dashed lines.
See also set_dash_joinstyle.
Return the line data as an (xdata, ydata) pair.
If orig is True, return the original data.
Return the drawstyle.
See also set_drawstyle.
Alias for get_drawstyle.
Return the marker fill style.
See also set_fillstyle.
Return the linestyle.
See also set_linestyle.
Return the linewidth in points.
See also set_linewidth.
Alias for get_linestyle.
Alias for get_linewidth.
Return the line marker.
See also set_marker.
Return the marker edge color.
See also set_markeredgecolor.
Return the marker edge width in points.
See also set_markeredgewidth.
Return the marker face color.
See also set_markerfacecolor.
Return the alternate marker face color.
See also set_markerfacecoloralt.
Return the marker size in points.
See also set_markersize.
Return the markevery setting for marker subsampling.
See also set_markevery.
Alias for get_markeredgecolor.
Alias for get_markeredgewidth.
Alias for get_markerfacecolor.
Alias for get_markerfacecoloralt.
Alias for get_markersize.
Return the Path associated with this line.
Return the pick radius used for containment tests.
See contains for more details.
Return the CapStyle for solid lines.
See also set_solid_capstyle.
Return the JoinStyle for solid lines.
See also set_solid_joinstyle.
Get the artist's bounding box in display space.
The bounding box' width and height are nonnegative.
Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.
Return the xdata.
If orig is True, return the original data, else the processed data.
Return the xy data as a Nx2 numpy array.
Return the ydata.
If orig is True, return the original data, else the processed data.
Return whether line has a dashed linestyle.
A custom linestyle is assumed to be dashed, we do not inspect the onoffseq directly.
See also set_linestyle.
Return the pick radius used for containment tests.
See contains for more details.
Set multiple properties at once.
Supported properties are
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
scalar or None
animated
bool
antialiased
bool
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
color
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
{'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
{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth
float
marker
marker style string, Path or MarkerStyle
markeredgecolor
color
markeredgewidth
float
markerfacecolor
color
markerfacecoloralt
color
markersize
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
Alias for set_antialiased.
Set whether to use antialiased rendering.
Alias for set_color.
Set the color of the line.
How to draw the end caps if the line is is_dashed.
How to join segments of the line if it is_dashed.
Set the dash sequence.
The dash sequence is a sequence of floats of even length describing the length of dashes and spaces in points.
For example, (5, 2, 1, 2) describes a sequence of 5 point and 1 point dashes separated by 2 point spaces.
If seq is empty or (None, None), the linestyle will be set to solid.
Set the x and y data.
Set the drawstyle of the plot.
The drawstyle determines how the points are connected.
For 'default', the points are connected with straight lines.
The steps variants connect the points with step-like lines, i.e. horizontal lines with vertical steps. They differ in the location of the step:
For examples see Step Demo.
Alias for set_drawstyle.
Set the marker fill style.
Possible values:
For examples see Marker fill styles.
Set the linestyle of the line.
Possible values:
A string:
linestyle
description
'-' or 'solid'
solid line
'--' or 'dashed'
dashed line
'-.' or 'dashdot'
dash-dotted line
':' or 'dotted'
dotted line
'none', 'None', ' ', or ''
draw nothing
Alternatively a dash tuple of the following form can be provided:
where onoffseq is an even length tuple of on and off ink in points. See also set_dashes().
For examples see Linestyles.
Set the line width in points.
Line width, in points.
Alias for set_linestyle.
Alias for set_linewidth.
Set the line marker.
See markers for full description of possible arguments.
Set the marker edge color.
Set the marker edge width in points.
Marker edge width, in points.
Set the marker face color.
Set the alternate marker face color.
Set the marker size in points.
Marker size, in points.
Set the markevery property to subsample the plot when using markers.
e.g., if every=5, every 5-th marker will be plotted.
Which markers to plot.
For examples see Markevery Demo.
Setting markevery will still only draw markers at actual data points. While the float argument form aims for uniform visual spacing, it has to coerce from the ideal spacing to the nearest available data point. Depending on the number and distribution of data points, the result may still not look evenly spaced.
When using a start offset to specify the first marker, the offset will be from the first data point which may be different from the first the visible data point if the plot is zoomed in.
If zooming in on a plot when using float arguments then the actual data points that have markers will change because the distance between markers is always determined from the display-coordinates axes-bounding-box-diagonal regardless of the actual axes data limits.
Alias for set_markeredgecolor.
Alias for set_markeredgewidth.
Alias for set_markerfacecolor.
Alias for set_markerfacecoloralt.
Alias for set_markersize.
Set the event picker details for the line.
If a float, it is used as the pick radius in points.
Set the pick radius used for containment tests.
See contains for more details.
Pick radius, in points.
How to draw the end caps if the line is solid (not is_dashed)
How to join segments if the line is solid (not is_dashed).
Set the artist transform.
Set the data array for x.
Set the data array for y.
Copy properties from other to self.
Customizing dashed line styles
Stem Plot
Figure labels: suptitle, supxlabel, supylabel
Boxplots
Scale invariant angle label
Annotating Plots
Composing Custom Legends
Annotation arrow style reference
Figure legend demo
Legend Demo
Artist within an artist
Annotating a plot
Annotation Polar
Fig Axes Customize Simple
Simple axes labels
Adding lines to figures
Reference for Matplotlib artists
PathPatch object
Parasite Simple
Parasite Axes demo
Parasite axis demo
Bachelor's degrees by gender
Decay
The double pendulum problem
Animated line plot
Oscilloscope
MATPLOTLIB UNCHAINED
Data Browser
Legend Picking
Looking Glass
Pick Event Demo
Pick Event Demo2
Poly Editor
Resampling Data
Anchored Artists
Cross hair cursor
Patheffect Demo
Set and get properties
SVG Filter Line
SkewT-logP diagram: using transforms and custom projections
Multiple Yaxis With Spines
Artist tests
Simple Legend02
Annotated Cursor
Buttons
Check Buttons
Radio Buttons
Thresholding an Image with RangeSlider
Slider
Snapping Sliders to Discrete Values
Span Selector
Textbox
Basic Usage
Pyplot tutorial
Artist tutorial
Legend guide
Faster rendering by using blitting
Transformations Tutorial


Test whether mouseevent occurred on the line.
An event is deemed to have occurred "on" the line if it is less than self.pickradius (default: 5 points) away from it. Use get_pickradius or set_pickradius to get or set the pick radius.
Whether any values are within the radius.
A dictionary {'ind': pointlist}, where pointlist is a list of points of the line that are within the pickradius around the event position.
TODO: sort returned indices by distance


Draw the Artist (and its children) using the given renderer.
This has no effect if the artist is not visible (Artist.get_visible returns False).
This method is overridden in the Artist subclasses.


Return whether antialiased rendering is used.


Return the line color.
See also set_color.


Return the CapStyle for dashed lines.
See also set_dash_capstyle.


Return the JoinStyle for dashed lines.
See also set_dash_joinstyle.


Return the line data as an (xdata, ydata) pair.
If orig is True, return the original data.


Return the drawstyle.
See also set_drawstyle.


Return the marker fill style.
See also set_fillstyle.


Return the linestyle.
See also set_linestyle.


Return the linewidth in points.
See also set_linewidth.


Return the line marker.
See also set_marker.


Return the marker edge color.
See also set_markeredgecolor.


Return the marker edge width in points.
See also set_markeredgewidth.


Return the marker face color.
See also set_markerfacecolor.


Return the alternate marker face color.
See also set_markerfacecoloralt.


Return the marker size in points.
See also set_markersize.


Return the markevery setting for marker subsampling.
See also set_markevery.


Return the Path associated with this line.


Return the pick radius used for containment tests.
See contains for more details.


Return the CapStyle for solid lines.
See also set_solid_capstyle.


Return the JoinStyle for solid lines.
See also set_solid_joinstyle.


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


Return the xdata.
If orig is True, return the original data, else the processed data.


Return the xy data as a Nx2 numpy array.


Return the ydata.
If orig is True, return the original data, else the processed data.


Return whether line has a dashed linestyle.
A custom linestyle is assumed to be dashed, we do not inspect the onoffseq directly.
See also set_linestyle.


Set multiple properties at once.
Supported properties are
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
scalar or None
animated
bool
antialiased
bool
clip_box
Bbox
clip_on
bool
clip_path
Patch or (Path, Transform) or None
color
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
{'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
{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth
float
marker
marker style string, Path or MarkerStyle
markeredgecolor
color
markeredgewidth
float
markerfacecolor
color
markerfacecoloralt
color
markersize
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


Set whether to use antialiased rendering.


How to draw the end caps if the line is is_dashed.


How to join segments of the line if it is_dashed.


Set the dash sequence.
The dash sequence is a sequence of floats of even length describing the length of dashes and spaces in points.
For example, (5, 2, 1, 2) describes a sequence of 5 point and 1 point dashes separated by 2 point spaces.
If seq is empty or (None, None), the linestyle will be set to solid.


Set the drawstyle of the plot.
The drawstyle determines how the points are connected.
For 'default', the points are connected with straight lines.
The steps variants connect the points with step-like lines, i.e. horizontal lines with vertical steps. They differ in the location of the step:
For examples see Step Demo.


Set the marker fill style.
Possible values:
For examples see Marker fill styles.


Set the linestyle of the line.
Possible values:
A string:
linestyle
description
'-' or 'solid'
solid line
'--' or 'dashed'
dashed line
'-.' or 'dashdot'
dash-dotted line
':' or 'dotted'
dotted line
'none', 'None', ' ', or ''
draw nothing
Alternatively a dash tuple of the following form can be provided:
where onoffseq is an even length tuple of on and off ink in points. See also set_dashes().
For examples see Linestyles.


Set the line width in points.
Line width, in points.


Set the line marker.
See markers for full description of possible arguments.


Set the marker edge width in points.
Marker edge width, in points.


Set the marker size in points.
Marker size, in points.


Set the markevery property to subsample the plot when using markers.
e.g., if every=5, every 5-th marker will be plotted.
Which markers to plot.
For examples see Markevery Demo.
Setting markevery will still only draw markers at actual data points. While the float argument form aims for uniform visual spacing, it has to coerce from the ideal spacing to the nearest available data point. Depending on the number and distribution of data points, the result may still not look evenly spaced.
When using a start offset to specify the first marker, the offset will be from the first data point which may be different from the first the visible data point if the plot is zoomed in.
If zooming in on a plot when using float arguments then the actual data points that have markers will change because the distance between markers is always determined from the display-coordinates axes-bounding-box-diagonal regardless of the actual axes data limits.


Set the event picker details for the line.
If a float, it is used as the pick radius in points.


Set the pick radius used for containment tests.
See contains for more details.
Pick radius, in points.


How to draw the end caps if the line is solid (not is_dashed)


How to join segments if the line is solid (not is_dashed).


Return the indices of the segments in the polyline with coordinates (cx, cy) that are within a distance radius of the point (x, y).


Bases: object
Manage the callbacks to maintain a list of selected vertices for Line2D. Derived classes should override the process_selected method to do something with the picks.
Here is an example which highlights the selected verts with red circles:
Initialize the class with a Line2D. The line should already be added to an Axes and should have the picker property set.
When the line is picked, update the set of selected indices.
Default "do nothing" implementation of the process_selected method.
The indices of the selected vertices.
The coordinates of the selected vertices.


When the line is picked, update the set of selected indices.


Default "do nothing" implementation of the process_selected method.
The indices of the selected vertices.
The coordinates of the selected vertices.


Functions to handle markers; used by the marker functionality of plot, scatter, and errorbar.
All possible markers are defined here:
marker
symbol
description
"."
point
","
pixel
"o"
circle
"v"
triangle_down
"^"
triangle_up
"<"
triangle_left
">"
triangle_right
"1"
tri_down
"2"
tri_up
"3"
tri_left
"4"
tri_right
"8"
octagon
"s"
square
"p"
pentagon
"P"
plus (filled)
"*"
star
"h"
hexagon1
"H"
hexagon2
"+"
plus
"x"
x
"X"
x (filled)
"D"
diamond
"d"
thin_diamond
"|"
vline
"_"
hline
0 (TICKLEFT)
tickleft
1 (TICKRIGHT)
tickright
2 (TICKUP)
tickup
3 (TICKDOWN)
tickdown
4 (CARETLEFT)
caretleft
5 (CARETRIGHT)
caretright
6 (CARETUP)
caretup
7 (CARETDOWN)
caretdown
8 (CARETLEFTBASE)
caretleft (centered at base)
9 (CARETRIGHTBASE)
caretright (centered at base)
10 (CARETUPBASE)
caretup (centered at base)
11 (CARETDOWNBASE)
caretdown (centered at base)
"None", " " or ""
nothing
'$...$'
Render the string using mathtext. E.g "$f$" for marker showing the letter f.
verts
A list of (x, y) pairs used for Path vertices. The center of the marker is located at (0, 0) and the size is normalized, such that the created path is encapsulated inside the unit cell.
path
A Path instance.
(numsides, 0, angle)
A regular polygon with numsides sides, rotated by angle.
(numsides, 1, angle)
A star-like symbol with numsides sides, rotated by angle.
(numsides, 2, angle)
An asterisk with numsides sides, rotated by angle.
None is the default which means 'nothing', however this table is referred to from other docs for the valid inputs from marker inputs and in those cases None still means 'default'.
Note that special symbols can be defined via the STIX math font, e.g. "$\u266B$". For an overview over the STIX font symbols refer to the STIX font table. Also see the STIX Fonts.
Integer numbers from 0 to 11 create lines and triangles. Those are equally accessible via capitalized variables, like CARETDOWNBASE. Hence the following are equivalent:
Examples showing the use of markers:
MarkerStyle([marker, fillstyle])
A class representing marker types.


Bases: object
A class representing marker types.
Instances are immutable. If you need to change anything, create a new instance.
All known markers.
All known filled markers. This is a subset of markers.
The supported fillstyles.
One of 'full', 'left', 'right', 'bottom', 'top', 'none'.
Return a Path for the alternate part of the marker.
For unfilled markers, this is None; for filled markers, this is the area to be drawn with markerfacecoloralt.
Return the transform to be applied to the Path from MarkerStyle.get_alt_path().
Return a Path for the primary part of the marker.
For unfilled markers this is the whole marker, for filled markers, this is the area to be drawn with markerfacecolor.
Return the transform to be applied to the Path from MarkerStyle.get_path().
[Deprecated]
Deprecated since version 3.4:
[Deprecated]
Deprecated since version 3.4:


Return a Path for the alternate part of the marker.
For unfilled markers, this is None; for filled markers, this is the area to be drawn with markerfacecoloralt.


Return the transform to be applied to the Path from MarkerStyle.get_alt_path().


Return a Path for the primary part of the marker.
For unfilled markers this is the whole marker, for filled markers, this is the area to be drawn with markerfacecolor.


Return the transform to be applied to the Path from MarkerStyle.get_path().


[Deprecated]
Deprecated since version 3.4:


A module for parsing a subset of the TeX math syntax and rendering it to a Matplotlib backend.
For a tutorial of its usage, see Writing mathematical expressions. This document is primarily concerned with implementation details.
The module uses pyparsing to parse the TeX expression.
The Bakoma distribution of the TeX Computer Modern fonts, and STIX fonts are supported. There is experimental support for using arbitrary fonts, but results may vary without proper tweaking and metrics for those fonts.
Bases: object
Create a MathTextParser for the given backend output.
[Deprecated] Get the depth of a mathtext string.
A valid mathtext string, e.g., r'IQ: $sigma_i=15$'.
The dots-per-inch setting used to render the text.
Offset of the baseline from the bottom of the image, in pixels.
Deprecated since version 3.4.
Parse the given math expression s at the given dpi. If prop is provided, it is a FontProperties object specifying the "default" font to use in the math expression, used for all non-math text.
The results are cached, so multiple calls to parse with the same expression should be fast.
[Deprecated] Convert a mathtext string to a grayscale array and depth.
A valid mathtext string, e.g., r'IQ: $sigma_i=15$'.
The dots-per-inch setting used to render the text.
The font size in points
Mask array of rasterized tex.
Offset of the baseline from the bottom of the image, in pixels.
Deprecated since version 3.4.
[Deprecated] Render a tex expression to a PNG file.
A writable filename or fileobject.
A valid mathtext string, e.g., r'IQ: $sigma_i=15$'.
The text color.
The dots-per-inch setting used to render the text.
The font size in points.
Offset of the baseline from the bottom of the image, in pixels.
Deprecated since version 3.4.
[Deprecated] Convert a mathtext string to an RGBA array and depth.
A valid mathtext string, e.g., r'IQ: $sigma_i=15$'.
The text color.
The dots-per-inch setting used to render the text.
The font size in points.
RGBA color values of rasterized tex, colorized with color.
Offset of the baseline from the bottom of the image, in pixels.
Deprecated since version 3.4.
Bases: Warning
Bases: object
The base class for the mathtext backend-specific code. MathtextBackend subclasses interface between mathtext and specific Matplotlib graphics backends.
Subclasses need to override the following:
And optionally, if you need to use a FreeType hinting style:
Get the FreeType hinting type to use with this particular backend.
Return a backend-specific tuple to return to the backend after all processing is done.
Draw a glyph described by info to the reference point (ox, oy).
Draw a filled black rectangle from (x1, y1) to (x2, y2).
Set the dimension of the drawing canvas.
Bases: matplotlib.mathtext.MathtextBackend
Render glyphs and rectangles to an FTImage buffer, which is later transferred to the Agg image by the Agg backend.
Get the FreeType hinting type to use with this particular backend.
Return a backend-specific tuple to return to the backend after all processing is done.
Draw a glyph described by info to the reference point (ox, oy).
Draw a filled black rectangle from (x1, y1) to (x2, y2).
Set the dimension of the drawing canvas.
Bases: matplotlib.mathtext.MathtextBackendAgg
[Deprecated]
Deprecated since version 3.4:
Return a backend-specific tuple to return to the backend after all processing is done.
Bases: matplotlib.mathtext.MathtextBackend
[Deprecated] Store information to write a mathtext rendering to the Cairo backend.
Deprecated since version 3.4.
Return a backend-specific tuple to return to the backend after all processing is done.
Draw a glyph described by info to the reference point (ox, oy).
Draw a filled black rectangle from (x1, y1) to (x2, y2).
Bases: matplotlib.mathtext.MathtextBackend
Store information to write a mathtext rendering to the text path machinery.
Return a backend-specific tuple to return to the backend after all processing is done.
Draw a glyph described by info to the reference point (ox, oy).
Draw a filled black rectangle from (x1, y1) to (x2, y2).
Bases: matplotlib.mathtext.MathtextBackend
[Deprecated] Store information to write a mathtext rendering to the PDF backend.
Deprecated since version 3.4.
Return a backend-specific tuple to return to the backend after all processing is done.
Draw a glyph described by info to the reference point (ox, oy).
Draw a filled black rectangle from (x1, y1) to (x2, y2).
Bases: matplotlib.mathtext.MathtextBackend
[Deprecated] Store information to write a mathtext rendering to the PostScript backend.
Deprecated since version 3.4.
Return a backend-specific tuple to return to the backend after all processing is done.
Draw a glyph described by info to the reference point (ox, oy).
Draw a filled black rectangle from (x1, y1) to (x2, y2).
Bases: matplotlib.mathtext.MathtextBackend
[Deprecated] Store information to write a mathtext rendering to the SVG backend.
Deprecated since version 3.4.
Return a backend-specific tuple to return to the backend after all processing is done.
Draw a glyph described by info to the reference point (ox, oy).
Draw a filled black rectangle from (x1, y1) to (x2, y2).
Return the integer index (from the Unicode table) of symbol.
A single unicode character, a TeX command (e.g. r'pi') or a Type1 symbol name (e.g. 'phi').
If False, always treat as a single unicode character.
Given a math expression, renders it in a closely-clipped bounding box to an image file.
A math expression. The math portion must be enclosed in dollar signs.
Where to write the image data.
The size and style of the text.
The output dpi. If not set, the dpi is determined as for Figure.savefig.
The output format, e.g., 'svg', 'pdf', 'ps' or 'png'. If not set, the format is determined as for Figure.savefig.
[Deprecated]
Deprecated since version 3.4:


Return the integer index (from the Unicode table) of symbol.
A single unicode character, a TeX command (e.g. r'pi') or a Type1 symbol name (e.g. 'phi').
If False, always treat as a single unicode character.


Given a math expression, renders it in a closely-clipped bounding box to an image file.
A math expression. The math portion must be enclosed in dollar signs.
Where to write the image data.
The size and style of the text.
The output dpi. If not set, the dpi is determined as for Figure.savefig.
The output format, e.g., 'svg', 'pdf', 'ps' or 'png'. If not set, the format is determined as for Figure.savefig.


Bases: object
The base class for the mathtext backend-specific code. MathtextBackend subclasses interface between mathtext and specific Matplotlib graphics backends.
Subclasses need to override the following:
And optionally, if you need to use a FreeType hinting style:
Get the FreeType hinting type to use with this particular backend.
Return a backend-specific tuple to return to the backend after all processing is done.
Draw a glyph described by info to the reference point (ox, oy).
Draw a filled black rectangle from (x1, y1) to (x2, y2).
Set the dimension of the drawing canvas.


Get the FreeType hinting type to use with this particular backend.


Return a backend-specific tuple to return to the backend after all processing is done.


Draw a glyph described by info to the reference point (ox, oy).


Draw a filled black rectangle from (x1, y1) to (x2, y2).


Set the dimension of the drawing canvas.


Bases: matplotlib.mathtext.MathtextBackend
Render glyphs and rectangles to an FTImage buffer, which is later transferred to the Agg image by the Agg backend.
Get the FreeType hinting type to use with this particular backend.
Return a backend-specific tuple to return to the backend after all processing is done.
Draw a glyph described by info to the reference point (ox, oy).
Draw a filled black rectangle from (x1, y1) to (x2, y2).
Set the dimension of the drawing canvas.


Bases: matplotlib.mathtext.MathtextBackendAgg
[Deprecated]
Deprecated since version 3.4:
Return a backend-specific tuple to return to the backend after all processing is done.


Bases: matplotlib.mathtext.MathtextBackend
[Deprecated] Store information to write a mathtext rendering to the Cairo backend.
Deprecated since version 3.4.
Return a backend-specific tuple to return to the backend after all processing is done.
Draw a glyph described by info to the reference point (ox, oy).
Draw a filled black rectangle from (x1, y1) to (x2, y2).


Bases: matplotlib.mathtext.MathtextBackend
Store information to write a mathtext rendering to the text path machinery.
Return a backend-specific tuple to return to the backend after all processing is done.
Draw a glyph described by info to the reference point (ox, oy).
Draw a filled black rectangle from (x1, y1) to (x2, y2).


Bases: matplotlib.mathtext.MathtextBackend
[Deprecated] Store information to write a mathtext rendering to the PDF backend.
Deprecated since version 3.4.
Return a backend-specific tuple to return to the backend after all processing is done.
Draw a glyph described by info to the reference point (ox, oy).
Draw a filled black rectangle from (x1, y1) to (x2, y2).


Bases: matplotlib.mathtext.MathtextBackend
[Deprecated] Store information to write a mathtext rendering to the PostScript backend.
Deprecated since version 3.4.
Return a backend-specific tuple to return to the backend after all processing is done.
Draw a glyph described by info to the reference point (ox, oy).
Draw a filled black rectangle from (x1, y1) to (x2, y2).


Bases: matplotlib.mathtext.MathtextBackend
[Deprecated] Store information to write a mathtext rendering to the SVG backend.
Deprecated since version 3.4.
Return a backend-specific tuple to return to the backend after all processing is done.
Draw a glyph described by info to the reference point (ox, oy).
Draw a filled black rectangle from (x1, y1) to (x2, y2).


Bases: object
Create a MathTextParser for the given backend output.
[Deprecated] Get the depth of a mathtext string.
A valid mathtext string, e.g., r'IQ: $sigma_i=15$'.
The dots-per-inch setting used to render the text.
Offset of the baseline from the bottom of the image, in pixels.
Deprecated since version 3.4.
Parse the given math expression s at the given dpi. If prop is provided, it is a FontProperties object specifying the "default" font to use in the math expression, used for all non-math text.
The results are cached, so multiple calls to parse with the same expression should be fast.
[Deprecated] Convert a mathtext string to a grayscale array and depth.
A valid mathtext string, e.g., r'IQ: $sigma_i=15$'.
The dots-per-inch setting used to render the text.
The font size in points
Mask array of rasterized tex.
Offset of the baseline from the bottom of the image, in pixels.
Deprecated since version 3.4.
[Deprecated] Render a tex expression to a PNG file.
A writable filename or fileobject.
A valid mathtext string, e.g., r'IQ: $sigma_i=15$'.
The text color.
The dots-per-inch setting used to render the text.
The font size in points.
Offset of the baseline from the bottom of the image, in pixels.
Deprecated since version 3.4.
[Deprecated] Convert a mathtext string to an RGBA array and depth.
A valid mathtext string, e.g., r'IQ: $sigma_i=15$'.
The text color.
The dots-per-inch setting used to render the text.
The font size in points.
RGBA color values of rasterized tex, colorized with color.
Offset of the baseline from the bottom of the image, in pixels.
Deprecated since version 3.4.


[Deprecated] Get the depth of a mathtext string.
A valid mathtext string, e.g., r'IQ: $sigma_i=15$'.
The dots-per-inch setting used to render the text.
Offset of the baseline from the bottom of the image, in pixels.
Deprecated since version 3.4.


Parse the given math expression s at the given dpi. If prop is provided, it is a FontProperties object specifying the "default" font to use in the math expression, used for all non-math text.
The results are cached, so multiple calls to parse with the same expression should be fast.


[Deprecated] Convert a mathtext string to a grayscale array and depth.
A valid mathtext string, e.g., r'IQ: $sigma_i=15$'.
The dots-per-inch setting used to render the text.
The font size in points
Mask array of rasterized tex.
Offset of the baseline from the bottom of the image, in pixels.
Deprecated since version 3.4.


[Deprecated] Render a tex expression to a PNG file.
A writable filename or fileobject.
A valid mathtext string, e.g., r'IQ: $sigma_i=15$'.
The text color.
The dots-per-inch setting used to render the text.
The font size in points.
Offset of the baseline from the bottom of the image, in pixels.
Deprecated since version 3.4.


[Deprecated] Convert a mathtext string to an RGBA array and depth.
A valid mathtext string, e.g., r'IQ: $sigma_i=15$'.
The text color.
The dots-per-inch setting used to render the text.
The font size in points.
RGBA color values of rasterized tex, colorized with color.
Offset of the baseline from the bottom of the image, in pixels.
Deprecated since version 3.4.


[Deprecated]
Deprecated since version 3.4:


Select the backend used for rendering and GUI integration.
The backend to switch to. This can either be one of the standard backend names, which are case-insensitive:
or a string of the form: module://my.module.name.
Switching to an interactive backend is not possible if an unrelated event loop has already been started (e.g., switching to GTK3Agg if a TkAgg window has already been opened). Switching to a non-interactive backend is always possible.
If True (the default), raise an ImportError if the backend cannot be set up (either because it fails to import, or because an incompatible GUI interactive framework is already running); if False, silently ignore the failure.
See also
Return the name of the current backend.
See also
Set whether to redraw after every plotting command (e.g. pyplot.xlabel).
Return whether to redraw after every plotting command.
Note
This function is only intended for use in backends. End users should use pyplot.isinteractive instead.
An instance of RcParams for handling default Matplotlib values.
A dictionary object including validation.
Validating functions are defined and associated with rc parameters in matplotlib.rcsetup.
The list of rcParams is:
See also
Return the subset of this RcParams dictionary whose keys match, using re.search(), the given pattern.
Note
Changes to the returned dictionary are not propagated to the parent RcParams dictionary.
Return a context manager for temporarily changing rcParams.
The rcParams to temporarily set.
A file with Matplotlib rc settings. If both fname and rc are given, settings from rc take precedence.
See also
Passing explicit values via a dict:
Loading settings from a file:
Set the current rcParams. group is the grouping for the rc, e.g., for lines.linewidth the group is lines, for axes.facecolor, the group is axes, and so on. Group may also be a list or tuple of group names, e.g., (xtick, ytick). kwargs is a dictionary attribute name/value pairs, e.g.,:
sets the current rcParams and is equivalent to:
The following aliases are available to save typing for interactive users:
Alias
Property
'lw'
'linewidth'
'ls'
'linestyle'
'c'
'color'
'fc'
'facecolor'
'ec'
'edgecolor'
'mew'
'markeredgewidth'
'aa'
'antialiased'
Thus you could abbreviate the above call as:
Note you can use python's kwargs dictionary facility to store dictionaries of default parameters. e.g., you can customize the font rc as follows:
This enables you to easily switch between several configurations. Use matplotlib.style.use('default') or rcdefaults() to restore the default rcParams after changes.
Similar functionality is available by using the normal dict interface, i.e. rcParams.update({"lines.linewidth": 2, ...}) (but rcParams.update does not support abbreviations or grouping).
Restore the rcParams from Matplotlib's internal default style.
Style-blacklisted rcParams (defined in matplotlib.style.core.STYLE_BLACKLIST) are not updated.
See also
Restore the rcParams from the rc file originally loaded by Matplotlib.
Use a specific style file. Call style.use('default') to restore the default style.
Restore the rcParams from the original rc file loaded by Matplotlib.
Style-blacklisted rcParams (defined in matplotlib.style.core.STYLE_BLACKLIST) are not updated.
Update rcParams from file.
Style-blacklisted rcParams (defined in matplotlib.style.core.STYLE_BLACKLIST) are not updated.
A file with Matplotlib rc settings.
If True, initialize with default parameters before updating with those in the given file. If False, the current configuration persists and only the parameters specified in the file are updated.
Construct a RcParams instance from the default Matplotlib rc file.
Construct a RcParams from file fname.
A file with Matplotlib rc settings.
If True, raise an error when the parser fails to convert a parameter.
If True, initialize with default parameters before updating with those in the given file. If False, the configuration class only contains the parameters specified in the file. (Useful for updating dicts.)
Return the string path of the configuration directory.
The directory is chosen as follows:
Get the location of the config file.
The file location is determined in the following order
Return the path to Matplotlib data.
Set Matplotlib's root logger and root logger handler level, creating the handler if it does not exist yet.
Typically, one should call set_loglevel("info") or set_loglevel("debug") to get additional debugging information.
The log level of the handler.
The first time this function is called, an additional handler is attached to Matplotlib's root handler; this handler is reused every time and this function simply manipulates the logger and handler's level.
Container for colormaps that are known to Matplotlib by name.
Experimental
While we expect the API to be final, we formally mark it as experimental for 3.5 because we want to keep the option to still adapt the API for 3.6 should the need arise.
The universal registry instance is matplotlib.colormaps. There should be no need for users to instantiate ColormapRegistry themselves.
Read access uses a dict-like interface mapping names to Colormaps:
Returned Colormaps are copies, so that their modification does not change the global definition of the colormap.
Additional colormaps can be added via ColormapRegistry.register:
Return the string path of the cache directory.
The procedure used to find the directory is the same as for _get_config_dir, except using $XDG_CACHE_HOME/$HOME/.cache instead.


Get the location of the config file.
The file location is determined in the following order


Numerical Python functions written for compatibility with MATLAB commands with the same names. Most numerical Python functions can be found in the NumPy and SciPy libraries. What remains here is code for performing spectral computations and kernel density estimations.
Coherence (normalized cross spectral density)
Cross spectral density using Welch's average periodogram
Remove the mean or best fit line from an array
Power spectral density using Welch's average periodogram
Spectrogram (spectrum over segments of time)
Return the complex-valued frequency spectrum of a signal
Return the magnitude of the frequency spectrum of a signal
Return the angle (wrapped phase) of the frequency spectrum of a signal
Return the phase (unwrapped angle) of the frequency spectrum of a signal
Remove the mean from a line.
Remove the best fit line from a line.
Return the original line.
Get all windows in an array in a memory-efficient manner
Bases: object
Representation of a kernel-density estimate using Gaussian kernels.
Datapoints to estimate from. In case of univariate data this is a 1-D array, otherwise a 2D array with shape (# of dims, # of data).
The method used to calculate the estimator bandwidth. This can be 'scott', 'silverman', a scalar constant or a callable. If a scalar, this will be used directly as kde.factor. If a callable, it should take a GaussianKDE instance as only parameter and return a scalar. If None (default), 'scott' is used.
The dataset with which gaussian_kde was initialized.
Number of dimensions.
Number of datapoints.
The bandwidth factor, obtained from kde.covariance_factor, with which the covariance matrix is multiplied.
The covariance matrix of dataset, scaled by the calculated bandwidth (kde.factor).
The inverse of covariance.
kde.evaluate(points)
(ndarray) Evaluate the estimated pdf on a provided set of points.
kde(points)
(ndarray) Same as kde.evaluate(points)
Evaluate the estimated pdf on a set of points.
Alternatively, a (# of dimensions,) vector can be passed in and treated as a single point.
The values at each point.
than the dimensionality of the KDE.
Compute the angle of the frequency spectrum (wrapped phase spectrum) of x. Data is padded to a length of pad_to and the windowing function window is applied to the signal.
Array or sequence containing the data
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing the FFT. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to the length of the input signal (i.e. no padding).
The angle of the frequency spectrum (wrapped phase spectrum).
The frequencies corresponding to the elements in spectrum.
See also
Returns the power spectral density.
Returns the complex-valued frequency spectrum.
Returns the absolute value of the complex_spectrum.
Returns the angle of the complex_spectrum.
Returns the phase (unwrapped angle) of the complex_spectrum.
Can return the complex spectrum of segments within the signal.
The coherence between x and y. Coherence is the normalized cross spectral density:
Array or sequence containing the data
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing the FFT. This can be different from NFFT, which specifies the number of data points used. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to NFFT
The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
The function applied to each segment before fft-ing, designed to remove the mean or linear trend. Unlike in MATLAB, where the detrend parameter is a vector, in Matplotlib it is a function. The mlab module defines detrend_none, detrend_mean, and detrend_linear, but you can use a custom function as well. You can also use a string to choose one of the functions: 'none' calls detrend_none. 'mean' calls detrend_mean. 'linear' calls detrend_linear.
Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of Hz^-1. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
The number of points of overlap between segments.
The coherence vector.
The frequencies for the elements in Cxy.
See also
For information about the methods used to compute \(P_{xy}\), \(P_{xx}\) and \(P_{yy}\).
Compute the complex-valued frequency spectrum of x. Data is padded to a length of pad_to and the windowing function window is applied to the signal.
Array or sequence containing the data
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing the FFT. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to the length of the input signal (i.e. no padding).
The complex-valued frequency spectrum.
The frequencies corresponding to the elements in spectrum.
See also
Returns the power spectral density.
Returns the complex-valued frequency spectrum.
Returns the absolute value of the complex_spectrum.
Returns the angle of the complex_spectrum.
Returns the phase (unwrapped angle) of the complex_spectrum.
Can return the complex spectrum of segments within the signal.
Compute the cross-spectral density.
The cross spectral density \(P_{xy}\) by Welch's average periodogram method. The vectors x and y are 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 product of the direct FFTs of x and y are averaged over each segment to compute \(P_{xy}\), with a scaling to correct for power loss due to windowing.
If len(x) < NFFT or len(y) < NFFT, they will be zero padded to NFFT.
Arrays or sequences containing the data
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing the FFT. This can be different from NFFT, which specifies the number of data points used. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to NFFT
The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
The function applied to each segment before fft-ing, designed to remove the mean or linear trend. Unlike in MATLAB, where the detrend parameter is a vector, in Matplotlib it is a function. The mlab module defines detrend_none, detrend_mean, and detrend_linear, but you can use a custom function as well. You can also use a string to choose one of the functions: 'none' calls detrend_none. 'mean' calls detrend_mean. 'linear' calls detrend_linear.
Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of Hz^-1. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
The number of points of overlap between segments.
The values for the cross spectrum \(P_{xy}\) before scaling (real valued)
The frequencies corresponding to the elements in Pxy
See also
equivalent to setting y = x.
Bendat & Piersol -- Random Data: Analysis and Measurement Procedures, John Wiley & Sons (1986)
Return x with its trend removed.
Array or sequence containing the data.
The detrending algorithm to use. 'default', 'mean', and 'constant' are the same as detrend_mean. 'linear' is the same as detrend_linear. 'none' is the same as detrend_none. The default is 'mean'. See the corresponding functions for more details regarding the algorithms. Can also be a function that carries out the detrend operation.
The axis along which to do the detrending.
See also
Implementation of the 'mean' algorithm.
Implementation of the 'linear' algorithm.
Implementation of the 'none' algorithm.
Return x minus best fit line; 'linear' detrending.
Array or sequence containing the data
See also
Another detrend algorithm.
Another detrend algorithm.
A wrapper around all the detrend algorithms.
Return x minus the mean(x).
Array or sequence containing the data Can have any dimensionality
The axis along which to take the mean. See numpy.mean for a description of this argument.
See also
Another detrend algorithm.
Another detrend algorithm.
A wrapper around all the detrend algorithms.
Return x: no detrending.
An object containing the data
This parameter is ignored. It is included for compatibility with detrend_mean
See also
Another detrend algorithm.
Another detrend algorithm.
A wrapper around all the detrend algorithms.
Compute the magnitude (absolute value) of the frequency spectrum of x. Data is padded to a length of pad_to and the windowing function window is applied to the signal.
Array or sequence containing the data
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing the FFT. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to the length of the input signal (i.e. no padding).
The magnitude (absolute value) of the frequency spectrum.
The frequencies corresponding to the elements in spectrum.
See also
Returns the power spectral density.
Returns the complex-valued frequency spectrum.
Returns the absolute value of the complex_spectrum.
Returns the angle of the complex_spectrum.
Returns the phase (unwrapped angle) of the complex_spectrum.
Can return the complex spectrum of segments within the signal.
Compute the phase of the frequency spectrum (unwrapped phase spectrum) of x. Data is padded to a length of pad_to and the windowing function window is applied to the signal.
Array or sequence containing the data
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing the FFT. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to the length of the input signal (i.e. no padding).
The phase of the frequency spectrum (unwrapped phase spectrum).
The frequencies corresponding to the elements in spectrum.
See also
Returns the power spectral density.
Returns the complex-valued frequency spectrum.
Returns the absolute value of the complex_spectrum.
Returns the angle of the complex_spectrum.
Returns the phase (unwrapped angle) of the complex_spectrum.
Can return the complex spectrum of segments within the signal.
Compute 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}\).
If len(x) < NFFT, it will be zero padded to NFFT.
Array or sequence containing the data
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing the FFT. This can be different from NFFT, which specifies the number of data points used. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to NFFT
The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
The function applied to each segment before fft-ing, designed to remove the mean or linear trend. Unlike in MATLAB, where the detrend parameter is a vector, in Matplotlib it is a function. The mlab module defines detrend_none, detrend_mean, and detrend_linear, but you can use a custom function as well. You can also use a string to choose one of the functions: 'none' calls detrend_none. 'mean' calls detrend_mean. 'linear' calls detrend_linear.
Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of Hz^-1. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
The number of points of overlap between segments.
The values for the power spectrum \(P_{xx}\) (real valued)
The frequencies corresponding to the elements in Pxx
See also
specgram differs in the default overlap; in not returning the mean of the segment periodograms; and in returning the times of the segments.
returns the magnitude spectrum.
returns the spectral density between two signals.
Bendat & Piersol -- Random Data: Analysis and Measurement Procedures, John Wiley & Sons (1986)
Compute a spectrogram.
Compute and plot a spectrogram of data in x. Data are split into NFFT length segments and the spectrum of each section is computed. The windowing function window is applied to each segment, and the amount of overlap of each segment is specified with noverlap.
1-D array or sequence.
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing the FFT. This can be different from NFFT, which specifies the number of data points used. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to NFFT
The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
The function applied to each segment before fft-ing, designed to remove the mean or linear trend. Unlike in MATLAB, where the detrend parameter is a vector, in Matplotlib it is a function. The mlab module defines detrend_none, detrend_mean, and detrend_linear, but you can use a custom function as well. You can also use a string to choose one of the functions: 'none' calls detrend_none. 'mean' calls detrend_mean. 'linear' calls detrend_linear.
Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of Hz^-1. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
The number of points of overlap between blocks.
Returns the power spectral density.
Returns the complex-valued frequency spectrum.
Returns the magnitude spectrum.
Returns the phase spectrum without unwrapping.
Returns the phase spectrum with unwrapping.
2D array, columns are the periodograms of successive segments.
1-D array, frequencies corresponding to the rows in spectrum.
1-D array, the times corresponding to midpoints of segments (i.e the columns in spectrum).
See also
differs in the overlap and in the return values.
similar, but with complex valued frequencies.
similar single segment when mode is 'magnitude'.
similar to single segment when mode is 'angle'.
similar to single segment when mode is 'phase'.
detrend and scale_by_freq only apply when mode is set to 'psd'.
Get all windows of x with length n as a single array, using strides to avoid data duplication.
Warning
It is not safe to write to the output array. Multiple elements may point to the same piece of memory, so modifying one value may change others.
Array or sequence containing the data.
The number of data points in each window.
The overlap between adjacent windows.
The axis along which the windows will run.
stackoverflow: Rolling window for 1D arrays in Numpy? stackoverflow: Using strides for an efficient moving average filter
Return x times the hanning window of len(x).
See also
Another window algorithm.
No window function; simply return x.
See also
Another window algorithm.


Compute the angle of the frequency spectrum (wrapped phase spectrum) of x. Data is padded to a length of pad_to and the windowing function window is applied to the signal.
Array or sequence containing the data
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing the FFT. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to the length of the input signal (i.e. no padding).
The angle of the frequency spectrum (wrapped phase spectrum).
The frequencies corresponding to the elements in spectrum.
See also
Returns the power spectral density.
Returns the complex-valued frequency spectrum.
Returns the absolute value of the complex_spectrum.
Returns the angle of the complex_spectrum.
Returns the phase (unwrapped angle) of the complex_spectrum.
Can return the complex spectrum of segments within the signal.


The coherence between x and y. Coherence is the normalized cross spectral density:
Array or sequence containing the data
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing the FFT. This can be different from NFFT, which specifies the number of data points used. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to NFFT
The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
The function applied to each segment before fft-ing, designed to remove the mean or linear trend. Unlike in MATLAB, where the detrend parameter is a vector, in Matplotlib it is a function. The mlab module defines detrend_none, detrend_mean, and detrend_linear, but you can use a custom function as well. You can also use a string to choose one of the functions: 'none' calls detrend_none. 'mean' calls detrend_mean. 'linear' calls detrend_linear.
Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of Hz^-1. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
The number of points of overlap between segments.
The coherence vector.
The frequencies for the elements in Cxy.
See also
For information about the methods used to compute \(P_{xy}\), \(P_{xx}\) and \(P_{yy}\).


Compute the complex-valued frequency spectrum of x. Data is padded to a length of pad_to and the windowing function window is applied to the signal.
Array or sequence containing the data
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing the FFT. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to the length of the input signal (i.e. no padding).
The complex-valued frequency spectrum.
The frequencies corresponding to the elements in spectrum.
See also
Returns the power spectral density.
Returns the complex-valued frequency spectrum.
Returns the absolute value of the complex_spectrum.
Returns the angle of the complex_spectrum.
Returns the phase (unwrapped angle) of the complex_spectrum.
Can return the complex spectrum of segments within the signal.


Compute the cross-spectral density.
The cross spectral density \(P_{xy}\) by Welch's average periodogram method. The vectors x and y are 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 product of the direct FFTs of x and y are averaged over each segment to compute \(P_{xy}\), with a scaling to correct for power loss due to windowing.
If len(x) < NFFT or len(y) < NFFT, they will be zero padded to NFFT.
Arrays or sequences containing the data
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing the FFT. This can be different from NFFT, which specifies the number of data points used. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to NFFT
The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
The function applied to each segment before fft-ing, designed to remove the mean or linear trend. Unlike in MATLAB, where the detrend parameter is a vector, in Matplotlib it is a function. The mlab module defines detrend_none, detrend_mean, and detrend_linear, but you can use a custom function as well. You can also use a string to choose one of the functions: 'none' calls detrend_none. 'mean' calls detrend_mean. 'linear' calls detrend_linear.
Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of Hz^-1. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
The number of points of overlap between segments.
The values for the cross spectrum \(P_{xy}\) before scaling (real valued)
The frequencies corresponding to the elements in Pxy
See also
equivalent to setting y = x.
Bendat & Piersol -- Random Data: Analysis and Measurement Procedures, John Wiley & Sons (1986)


Return x with its trend removed.
Array or sequence containing the data.
The detrending algorithm to use. 'default', 'mean', and 'constant' are the same as detrend_mean. 'linear' is the same as detrend_linear. 'none' is the same as detrend_none. The default is 'mean'. See the corresponding functions for more details regarding the algorithms. Can also be a function that carries out the detrend operation.
The axis along which to do the detrending.
See also
Implementation of the 'mean' algorithm.
Implementation of the 'linear' algorithm.
Implementation of the 'none' algorithm.


Return x minus best fit line; 'linear' detrending.
Array or sequence containing the data
See also
Another detrend algorithm.
Another detrend algorithm.
A wrapper around all the detrend algorithms.


Return x minus the mean(x).
Array or sequence containing the data Can have any dimensionality
The axis along which to take the mean. See numpy.mean for a description of this argument.
See also
Another detrend algorithm.
Another detrend algorithm.
A wrapper around all the detrend algorithms.


Return x: no detrending.
An object containing the data
This parameter is ignored. It is included for compatibility with detrend_mean
See also
Another detrend algorithm.
Another detrend algorithm.
A wrapper around all the detrend algorithms.


Bases: object
Representation of a kernel-density estimate using Gaussian kernels.
Datapoints to estimate from. In case of univariate data this is a 1-D array, otherwise a 2D array with shape (# of dims, # of data).
The method used to calculate the estimator bandwidth. This can be 'scott', 'silverman', a scalar constant or a callable. If a scalar, this will be used directly as kde.factor. If a callable, it should take a GaussianKDE instance as only parameter and return a scalar. If None (default), 'scott' is used.
The dataset with which gaussian_kde was initialized.
Number of dimensions.
Number of datapoints.
The bandwidth factor, obtained from kde.covariance_factor, with which the covariance matrix is multiplied.
The covariance matrix of dataset, scaled by the calculated bandwidth (kde.factor).
The inverse of covariance.
kde.evaluate(points)
(ndarray) Evaluate the estimated pdf on a provided set of points.
kde(points)
(ndarray) Same as kde.evaluate(points)
Evaluate the estimated pdf on a set of points.
Alternatively, a (# of dimensions,) vector can be passed in and treated as a single point.
The values at each point.
than the dimensionality of the KDE.


Evaluate the estimated pdf on a set of points.
Alternatively, a (# of dimensions,) vector can be passed in and treated as a single point.
The values at each point.
than the dimensionality of the KDE.


Compute the magnitude (absolute value) of the frequency spectrum of x. Data is padded to a length of pad_to and the windowing function window is applied to the signal.
Array or sequence containing the data
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing the FFT. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to the length of the input signal (i.e. no padding).
The magnitude (absolute value) of the frequency spectrum.
The frequencies corresponding to the elements in spectrum.
See also
Returns the power spectral density.
Returns the complex-valued frequency spectrum.
Returns the absolute value of the complex_spectrum.
Returns the angle of the complex_spectrum.
Returns the phase (unwrapped angle) of the complex_spectrum.
Can return the complex spectrum of segments within the signal.


Compute the phase of the frequency spectrum (unwrapped phase spectrum) of x. Data is padded to a length of pad_to and the windowing function window is applied to the signal.
Array or sequence containing the data
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing the FFT. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to the length of the input signal (i.e. no padding).
The phase of the frequency spectrum (unwrapped phase spectrum).
The frequencies corresponding to the elements in spectrum.
See also
Returns the power spectral density.
Returns the complex-valued frequency spectrum.
Returns the absolute value of the complex_spectrum.
Returns the angle of the complex_spectrum.
Returns the phase (unwrapped angle) of the complex_spectrum.
Can return the complex spectrum of segments within the signal.


Compute 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}\).
If len(x) < NFFT, it will be zero padded to NFFT.
Array or sequence containing the data
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing the FFT. This can be different from NFFT, which specifies the number of data points used. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to NFFT
The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
The function applied to each segment before fft-ing, designed to remove the mean or linear trend. Unlike in MATLAB, where the detrend parameter is a vector, in Matplotlib it is a function. The mlab module defines detrend_none, detrend_mean, and detrend_linear, but you can use a custom function as well. You can also use a string to choose one of the functions: 'none' calls detrend_none. 'mean' calls detrend_mean. 'linear' calls detrend_linear.
Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of Hz^-1. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
The number of points of overlap between segments.
The values for the power spectrum \(P_{xx}\) (real valued)
The frequencies corresponding to the elements in Pxx
See also
specgram differs in the default overlap; in not returning the mean of the segment periodograms; and in returning the times of the segments.
returns the magnitude spectrum.
returns the spectral density between two signals.
Bendat & Piersol -- Random Data: Analysis and Measurement Procedures, John Wiley & Sons (1986)


Compute a spectrogram.
Compute and plot a spectrogram of data in x. Data are split into NFFT length segments and the spectrum of each section is computed. The windowing function window is applied to each segment, and the amount of overlap of each segment is specified with noverlap.
1-D array or sequence.
The sampling frequency (samples per time unit). It is used to calculate the Fourier frequencies, freqs, in cycles per time unit.
A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
The number of points to which the data segment is padded when performing the FFT. This can be different from NFFT, which specifies the number of data points used. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to NFFT
The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
The function applied to each segment before fft-ing, designed to remove the mean or linear trend. Unlike in MATLAB, where the detrend parameter is a vector, in Matplotlib it is a function. The mlab module defines detrend_none, detrend_mean, and detrend_linear, but you can use a custom function as well. You can also use a string to choose one of the functions: 'none' calls detrend_none. 'mean' calls detrend_mean. 'linear' calls detrend_linear.
Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of Hz^-1. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
The number of points of overlap between blocks.
Returns the power spectral density.
Returns the complex-valued frequency spectrum.
Returns the magnitude spectrum.
Returns the phase spectrum without unwrapping.
Returns the phase spectrum with unwrapping.
2D array, columns are the periodograms of successive segments.
1-D array, frequencies corresponding to the rows in spectrum.
1-D array, the times corresponding to midpoints of segments (i.e the columns in spectrum).
See also
differs in the overlap and in the return values.
similar, but with complex valued frequencies.
similar single segment when mode is 'magnitude'.
similar to single segment when mode is 'angle'.
similar to single segment when mode is 'phase'.
detrend and scale_by_freq only apply when mode is set to 'psd'.


Get all windows of x with length n as a single array, using strides to avoid data duplication.
Warning
It is not safe to write to the output array. Multiple elements may point to the same piece of memory, so modifying one value may change others.
Array or sequence containing the data.
The number of data points in each window.
The overlap between adjacent windows.
The axis along which the windows will run.
stackoverflow: Rolling window for 1D arrays in Numpy? stackoverflow: Using strides for an efficient moving average filter


Return x times the hanning window of len(x).
See also
Another window algorithm.


No window function; simply return x.
See also
Another window algorithm.


The mplot3d toolkit adds simple 3D plotting capabilities (scatter, surface, line, mesh, etc.) to Matplotlib by supplying an Axes object that can create a 2D projection of a 3D scene. The resulting graph will have the same look and feel as regular 2D plots. Not the fastest or most feature complete 3D library out there, but it ships with Matplotlib and thus may be a lighter weight solution for some use cases.
See the mplot3d tutorial for more information.
The interactive backends also provide the ability to rotate and zoom the 3D scene. One can rotate the 3D scene by simply clicking-and-dragging the scene. Zooming is done by right-clicking the scene and dragging the mouse up and down (unlike 2D plots, the toolbar zoom button is not used).
Note
pyplot cannot be used to add content to 3D plots, because its function signatures are strictly 2D and cannot handle the additional information needed for 3D. Instead, use the explicit API by calling the respective methods on the Axes3D object.
Note
3D plotting in Matplotlib is still not as mature as the 2D case. Please report any functions that do not behave as expected as a bug. In addition, help and patches would be greatly appreciated!
axes3d.Axes3D(fig[, rect, azim, elev, ...])
3D axes object.
Note
See mpl_toolkits.mplot3d.axis3d._axinfo for a dictionary containing constants that may be modified for controlling the look and feel of mplot3d axes (e.g., label spacing, font colors and panel colors). Historically, axis3d has suffered from having hard-coded constants that precluded user adjustments, and this dictionary was implemented in version 1.1 as a stop-gap measure.
axis3d.Axis(adir, v_intervalx, d_intervalx, ...)
An Axis class for the 3D plots.
art3d.Line3D(xs, ys, zs, *args, **kwargs)
3D line object.
art3d.Line3DCollection(segments, *args[, zorder])
A collection of 3D lines.
art3d.Patch3D(*args[, zs, zdir])
3D patch object.
art3d.Patch3DCollection(*args[, zs, zdir, ...])
A collection of 3D patches.
art3d.Path3DCollection(*args[, zs, zdir, ...])
A collection of 3D paths.
art3d.PathPatch3D(path, *[, zs, zdir])
3D PathPatch object.
art3d.Poly3DCollection(verts, *args[, zsort])
A collection of 3D polygons.
art3d.Text3D([x, y, z, text, zdir])
Text object with 3D position and direction.
art3d.get_dir_vector(zdir)
Return a direction vector.
art3d.juggle_axes(xs, ys, zs, zdir)
Reorder coordinates so that 2D xs, ys can be plotted in the plane orthogonal to zdir.
art3d.line_2d_to_3d(line[, zs, zdir])
Convert a 2D line to 3D.
art3d.line_collection_2d_to_3d(col[, zs, zdir])
Convert a LineCollection to a Line3DCollection object.
art3d.patch_2d_to_3d(patch[, z, zdir])
Convert a Patch to a Patch3D object.
art3d.patch_collection_2d_to_3d(col[, zs, ...])
Convert a PatchCollection into a Patch3DCollection object (or a PathCollection into a Path3DCollection object).
art3d.pathpatch_2d_to_3d(pathpatch[, z, zdir])
Convert a PathPatch to a PathPatch3D object.
art3d.poly_collection_2d_to_3d(col[, zs, zdir])
Convert a PolyCollection to a Poly3DCollection object.
art3d.rotate_axes(xs, ys, zs, zdir)
Reorder coordinates so that the axes are rotated with zdir along the original z axis.
art3d.text_2d_to_3d(obj[, z, zdir])
Convert a Text to a Text3D object.
proj3d.inv_transform(xs, ys, zs, M)
proj3d.persp_transformation(zfront, zback)
proj3d.proj_points(points, M)
proj3d.proj_trans_points(points, M)
proj3d.proj_transform(xs, ys, zs, M)
Transform the points by the projection matrix
proj3d.proj_transform_clip(xs, ys, zs, M)
Transform the points by the projection matrix and return the clipping result returns txs, tys, tzs, tis
proj3d.rot_x(V, alpha)
proj3d.transform(xs, ys, zs, M)
Transform the points by the projection matrix
proj3d.view_transformation(E, R, V)
proj3d.world_transformation(xmin, xmax, ...)
Produce a matrix that scales homogeneous coords in the specified ranges to [0, 1], or [0, pb_aspect[i]] if the plotbox aspect ratio is specified.


Return a direction vector.
The direction. Possible values are:
The direction vector.


Reorder coordinates so that 2D xs, ys can be plotted in the plane orthogonal to zdir. zdir is normally x, y or z. However, if zdir starts with a '-' it is interpreted as a compensation for rotate_axes.


Bases: matplotlib.lines.Line2D
3D line object.
Keyword arguments are passed onto Line2D().
Draw the Artist (and its children) using the given renderer.
This has no effect if the artist is not visible (Artist.get_visible returns False).
This method is overridden in the Artist subclasses.
Get the current data
The current data as a tuple or array-like.
Set multiple properties at once.
Supported properties are
Property
Description
3d_properties
unknown
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
data_3d
unknown
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
Transform
url
str
visible
bool
xdata
1D array
ydata
1D array
zorder
float
Set the x, y and z data
The x-data to be plotted.
The y-data to be plotted.
The z-data to be plotted.
Accepts x, y, z arguments or a single array-like (x, y, z)
3D stem


Draw the Artist (and its children) using the given renderer.
This has no effect if the artist is not visible (Artist.get_visible returns False).
This method is overridden in the Artist subclasses.


Get the current data
The current data as a tuple or array-like.


Set multiple properties at once.
Supported properties are
Property
Description
3d_properties
unknown
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
data_3d
unknown
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
Transform
url
str
visible
bool
xdata
1D array
ydata
1D array
zorder
float


Set the x, y and z data
The x-data to be plotted.
The y-data to be plotted.
The z-data to be plotted.
Accepts x, y, z arguments or a single array-like (x, y, z)


Bases: matplotlib.collections.LineCollection
A collection of 3D lines.
A sequence of (line0, line1, line2), where:
or the equivalent numpy array with two columns. Each line can have a different number of segments.
The width of each line in points.
A sequence of RGBA tuples (e.g., arbitrary color strings, etc, not allowed).
Whether to use antialiasing for each line.
zorder of the lines once drawn.
When setting facecolors, each line is interpreted as a boundary for an area, implicitly closing the path from the last point to the first point. The enclosed area is filled with facecolor. In order to manually specify what should count as the "interior" of each line, please use PathCollection instead, where the "interior" can be specified by appropriate usage of CLOSEPOLY.
Forwarded to Collection.
Project the points according to renderer matrix.
Draw the Artist (and its children) using the given renderer.
This has no effect if the artist is not visible (Artist.get_visible returns False).
This method is overridden in the Artist subclasses.
Set multiple properties at once.
Supported properties are
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
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 colors
colors
color or list of colors
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
unknown
picker
None or bool or float or callable
pickradius
float
rasterized
bool
segments
unknown
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
sort_zpos
unknown
transform
Transform
url
str
urls
list of str or None
verts
unknown
visible
bool
zorder
float
Set 3D segments.
Set the position to use for z-sorting.
3D stem


Project the points according to renderer matrix.


Set multiple properties at once.
Supported properties are
Property
Description
agg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha
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 colors
colors
color or list of colors
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
unknown
picker
None or bool or float or callable
pickradius
float
rasterized
bool
segments
unknown
sketch_params
(scale: float, length: float, randomness: float)
snap
bool or None
sort_zpos
unknown
transform
Transform
url
str
urls
list of str or None
verts
unknown
visible
bool
zorder
float


Convert a LineCollection to a Line3DCollection object.