matplotlib.matplotlib_fname()[source]

Get the location of the config file. The file location is determined in the following order  $PWD/matplotlibrc
$MATPLOTLIBRC if it is not a directory $MATPLOTLIBRC/matplotlibrc $MPLCONFIGDIR/matplotlibrc
 On Linux,

$XDG_CONFIG_HOME/matplotlib/matplotlibrc (if $XDG_CONFIG_HOME is defined) or $HOME/.config/matplotlib/matplotlibrc (if $XDG_CONFIG_HOME is not defined)     On other platforms, - $HOME/.matplotlib/matplotlibrc if $HOME is defined Lastly, it looks in $MATPLOTLIBDATA/matplotlibrc, which should always exist.


matplotlib.mlab 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.  Spectral functions  cohere

Coherence (normalized cross spectral density)  csd

Cross spectral density using Welch's average periodogram  detrend

Remove the mean or best fit line from an array  psd

Power spectral density using Welch's average periodogram  specgram

Spectrogram (spectrum over segments of time)  complex_spectrum

Return the complex-valued frequency spectrum of a signal  magnitude_spectrum

Return the magnitude of the frequency spectrum of a signal  angle_spectrum

Return the angle (wrapped phase) of the frequency spectrum of a signal  phase_spectrum

Return the phase (unwrapped angle) of the frequency spectrum of a signal  detrend_mean

Remove the mean from a line.  detrend_linear

Remove the best fit line from a line.  detrend_none

Return the original line.  stride_windows

Get all windows in an array in a memory-efficient manner     classmatplotlib.mlab.GaussianKDE(dataset, bw_method=None)[source]

Bases: object Representation of a kernel-density estimate using Gaussian kernels.  Parameters

datasetarray-like

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).
bw_methodstr, scalar or callable, optional

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

datasetndarray

The dataset with which gaussian_kde was initialized.
dimint

Number of dimensions.
num_dpint

Number of datapoints.
factorfloat

The bandwidth factor, obtained from kde.covariance_factor, with which the covariance matrix is multiplied.
covariancendarray

The covariance matrix of dataset, scaled by the calculated bandwidth (kde.factor).
inv_covndarray

The inverse of covariance.     Methods
kde.evaluate(points) (ndarray) Evaluate the estimated pdf on a provided set of points.
kde(points) (ndarray) Same as kde.evaluate(points)     covariance_factor()[source]

   evaluate(points)[source]

Evaluate the estimated pdf on a set of points.  Parameters

points(# of dimensions, # of points)-array

Alternatively, a (# of dimensions,) vector can be passed in and treated as a single point.    Returns
 (# of points,)-array

The values at each point.    Raises

ValueErrorif the dimensionality of the input points is different

than the dimensionality of the KDE.
   scotts_factor()[source]

   silverman_factor()[source]

   matplotlib.mlab.angle_spectrum(x, Fs=None, window=None, pad_to=None, sides=None)

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.  Parameters

x1-D array or sequence

Array or sequence containing the data
Fsfloat, default: 2

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

A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
sides{'default', 'onesided', 'twosided'}, optional

Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
pad_toint, optional

The number of points to which the data segment is padded when performing the FFT. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to the length of the input signal (i.e. no padding).    Returns

spectrum1-D array

The angle of the frequency spectrum (wrapped phase spectrum).
freqs1-D array

The frequencies corresponding to the elements in spectrum.      See also  psd

Returns the power spectral density.  complex_spectrum

Returns the complex-valued frequency spectrum.  magnitude_spectrum

Returns the absolute value of the complex_spectrum.  angle_spectrum

Returns the angle of the complex_spectrum.  phase_spectrum

Returns the phase (unwrapped angle) of the complex_spectrum.  specgram

Can return the complex spectrum of segments within the signal.
   matplotlib.mlab.cohere(x, y, NFFT=256, Fs=2, detrend=<function detrend_none>, window=<function window_hanning>, noverlap=0, pad_to=None, sides='default', scale_by_freq=None)[source]

The coherence between x and y. Coherence is the normalized cross spectral density:  \[C_{xy} = \frac{|P_{xy}|^2}{P_{xx}P_{yy}}\]  Parameters
 x, y

Array or sequence containing the data
Fsfloat, default: 2

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

A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
sides{'default', 'onesided', 'twosided'}, optional

Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
pad_toint, optional

The number of points to which the data segment is padded when performing the FFT. This can be different from NFFT, which specifies the number of data points used. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to NFFT
NFFTint, default: 256

The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
detrend{'none', 'mean', 'linear'} or callable, default: 'none'

The function applied to each segment before fft-ing, designed to remove the mean or linear trend. Unlike in MATLAB, where the detrend parameter is a vector, in Matplotlib it is a function. The mlab module defines detrend_none, detrend_mean, and detrend_linear, but you can use a custom function as well. You can also use a string to choose one of the functions: 'none' calls detrend_none. 'mean' calls detrend_mean. 'linear' calls detrend_linear.
scale_by_freqbool, default: True

Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of Hz^-1. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
noverlapint, default: 0 (no overlap)

The number of points of overlap between segments.    Returns

Cxy1-D array

The coherence vector.
freqs1-D array

The frequencies for the elements in Cxy.      See also
psd(), csd()

For information about the methods used to compute \(P_{xy}\), \(P_{xx}\) and \(P_{yy}\).
   matplotlib.mlab.complex_spectrum(x, Fs=None, window=None, pad_to=None, sides=None)

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.  Parameters

x1-D array or sequence

Array or sequence containing the data
Fsfloat, default: 2

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

A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
sides{'default', 'onesided', 'twosided'}, optional

Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
pad_toint, optional

The number of points to which the data segment is padded when performing the FFT. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to the length of the input signal (i.e. no padding).    Returns

spectrum1-D array

The complex-valued frequency spectrum.
freqs1-D array

The frequencies corresponding to the elements in spectrum.      See also  psd

Returns the power spectral density.  complex_spectrum

Returns the complex-valued frequency spectrum.  magnitude_spectrum

Returns the absolute value of the complex_spectrum.  angle_spectrum

Returns the angle of the complex_spectrum.  phase_spectrum

Returns the phase (unwrapped angle) of the complex_spectrum.  specgram

Can return the complex spectrum of segments within the signal.
   matplotlib.mlab.csd(x, y, NFFT=None, Fs=None, detrend=None, window=None, noverlap=None, pad_to=None, sides=None, scale_by_freq=None)[source]

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.  Parameters

x, y1-D arrays or sequences

Arrays or sequences containing the data
Fsfloat, default: 2

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

A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
sides{'default', 'onesided', 'twosided'}, optional

Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
pad_toint, optional

The number of points to which the data segment is padded when performing the FFT. This can be different from NFFT, which specifies the number of data points used. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to NFFT
NFFTint, default: 256

The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
detrend{'none', 'mean', 'linear'} or callable, default: 'none'

The function applied to each segment before fft-ing, designed to remove the mean or linear trend. Unlike in MATLAB, where the detrend parameter is a vector, in Matplotlib it is a function. The mlab module defines detrend_none, detrend_mean, and detrend_linear, but you can use a custom function as well. You can also use a string to choose one of the functions: 'none' calls detrend_none. 'mean' calls detrend_mean. 'linear' calls detrend_linear.
scale_by_freqbool, default: True

Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of Hz^-1. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
noverlapint, default: 0 (no overlap)

The number of points of overlap between segments.    Returns

Pxy1-D array

The values for the cross spectrum \(P_{xy}\) before scaling (real valued)
freqs1-D array

The frequencies corresponding to the elements in Pxy      See also  psd

equivalent to setting y = x.    References Bendat & Piersol -- Random Data: Analysis and Measurement Procedures, John Wiley & Sons (1986)
   matplotlib.mlab.detrend(x, key=None, axis=None)[source]

Return x with its trend removed.  Parameters

xarray or sequence

Array or sequence containing the data.
key{'default', 'constant', 'mean', 'linear', 'none'} or function

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.
axisint

The axis along which to do the detrending.      See also  detrend_mean

Implementation of the 'mean' algorithm.  detrend_linear

Implementation of the 'linear' algorithm.  detrend_none

Implementation of the 'none' algorithm.
   matplotlib.mlab.detrend_linear(y)[source]

Return x minus best fit line; 'linear' detrending.  Parameters

y0-D or 1-D array or sequence

Array or sequence containing the data      See also  detrend_mean

Another detrend algorithm.  detrend_none

Another detrend algorithm.  detrend

A wrapper around all the detrend algorithms.
   matplotlib.mlab.detrend_mean(x, axis=None)[source]

Return x minus the mean(x).  Parameters

xarray or sequence

Array or sequence containing the data Can have any dimensionality
axisint

The axis along which to take the mean. See numpy.mean for a description of this argument.      See also  detrend_linear

Another detrend algorithm.  detrend_none

Another detrend algorithm.  detrend

A wrapper around all the detrend algorithms.
   matplotlib.mlab.detrend_none(x, axis=None)[source]

Return x: no detrending.  Parameters

xany object

An object containing the data
axisint

This parameter is ignored. It is included for compatibility with detrend_mean      See also  detrend_mean

Another detrend algorithm.  detrend_linear

Another detrend algorithm.  detrend

A wrapper around all the detrend algorithms.
   matplotlib.mlab.magnitude_spectrum(x, Fs=None, window=None, pad_to=None, sides=None)

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.  Parameters

x1-D array or sequence

Array or sequence containing the data
Fsfloat, default: 2

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

A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
sides{'default', 'onesided', 'twosided'}, optional

Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
pad_toint, optional

The number of points to which the data segment is padded when performing the FFT. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to the length of the input signal (i.e. no padding).    Returns

spectrum1-D array

The magnitude (absolute value) of the frequency spectrum.
freqs1-D array

The frequencies corresponding to the elements in spectrum.      See also  psd

Returns the power spectral density.  complex_spectrum

Returns the complex-valued frequency spectrum.  magnitude_spectrum

Returns the absolute value of the complex_spectrum.  angle_spectrum

Returns the angle of the complex_spectrum.  phase_spectrum

Returns the phase (unwrapped angle) of the complex_spectrum.  specgram

Can return the complex spectrum of segments within the signal.
   matplotlib.mlab.phase_spectrum(x, Fs=None, window=None, pad_to=None, sides=None)

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.  Parameters

x1-D array or sequence

Array or sequence containing the data
Fsfloat, default: 2

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

A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
sides{'default', 'onesided', 'twosided'}, optional

Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
pad_toint, optional

The number of points to which the data segment is padded when performing the FFT. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to the length of the input signal (i.e. no padding).    Returns

spectrum1-D array

The phase of the frequency spectrum (unwrapped phase spectrum).
freqs1-D array

The frequencies corresponding to the elements in spectrum.      See also  psd

Returns the power spectral density.  complex_spectrum

Returns the complex-valued frequency spectrum.  magnitude_spectrum

Returns the absolute value of the complex_spectrum.  angle_spectrum

Returns the angle of the complex_spectrum.  phase_spectrum

Returns the phase (unwrapped angle) of the complex_spectrum.  specgram

Can return the complex spectrum of segments within the signal.
   matplotlib.mlab.psd(x, NFFT=None, Fs=None, detrend=None, window=None, noverlap=None, pad_to=None, sides=None, scale_by_freq=None)[source]

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.  Parameters

x1-D array or sequence

Array or sequence containing the data
Fsfloat, default: 2

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

A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
sides{'default', 'onesided', 'twosided'}, optional

Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
pad_toint, optional

The number of points to which the data segment is padded when performing the FFT. This can be different from NFFT, which specifies the number of data points used. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to NFFT
NFFTint, default: 256

The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
detrend{'none', 'mean', 'linear'} or callable, default: 'none'

The function applied to each segment before fft-ing, designed to remove the mean or linear trend. Unlike in MATLAB, where the detrend parameter is a vector, in Matplotlib it is a function. The mlab module defines detrend_none, detrend_mean, and detrend_linear, but you can use a custom function as well. You can also use a string to choose one of the functions: 'none' calls detrend_none. 'mean' calls detrend_mean. 'linear' calls detrend_linear.
scale_by_freqbool, default: True

Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of Hz^-1. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
noverlapint, default: 0 (no overlap)

The number of points of overlap between segments.    Returns

Pxx1-D array

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

The frequencies corresponding to the elements in Pxx      See also  specgram

specgram differs in the default overlap; in not returning the mean of the segment periodograms; and in returning the times of the segments.  magnitude_spectrum

returns the magnitude spectrum.  csd

returns the spectral density between two signals.    References Bendat & Piersol -- Random Data: Analysis and Measurement Procedures, John Wiley & Sons (1986)
   matplotlib.mlab.specgram(x, NFFT=None, Fs=None, detrend=None, window=None, noverlap=None, pad_to=None, sides=None, scale_by_freq=None, mode=None)[source]

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.  Parameters

xarray-like

1-D array or sequence.
Fsfloat, default: 2

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

A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
sides{'default', 'onesided', 'twosided'}, optional

Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
pad_toint, optional

The number of points to which the data segment is padded when performing the FFT. This can be different from NFFT, which specifies the number of data points used. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to NFFT
NFFTint, default: 256

The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
detrend{'none', 'mean', 'linear'} or callable, default: 'none'

The function applied to each segment before fft-ing, designed to remove the mean or linear trend. Unlike in MATLAB, where the detrend parameter is a vector, in Matplotlib it is a function. The mlab module defines detrend_none, detrend_mean, and detrend_linear, but you can use a custom function as well. You can also use a string to choose one of the functions: 'none' calls detrend_none. 'mean' calls detrend_mean. 'linear' calls detrend_linear.
scale_by_freqbool, default: True

Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of Hz^-1. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
noverlapint, default: 128

The number of points of overlap between blocks.
modestr, default: 'psd'

 What sort of spectrum to use:

 'psd'

Returns the power spectral density.  'complex'

Returns the complex-valued frequency spectrum.  'magnitude'

Returns the magnitude spectrum.  'angle'

Returns the phase spectrum without unwrapping.  'phase'

Returns the phase spectrum with unwrapping.        Returns

spectrumarray-like

2D array, columns are the periodograms of successive segments.
freqsarray-like

1-D array, frequencies corresponding to the rows in spectrum.
tarray-like

1-D array, the times corresponding to midpoints of segments (i.e the columns in spectrum).      See also  psd

differs in the overlap and in the return values.  complex_spectrum

similar, but with complex valued frequencies.  magnitude_spectrum

similar single segment when mode is 'magnitude'.  angle_spectrum

similar to single segment when mode is 'angle'.  phase_spectrum

similar to single segment when mode is 'phase'.    Notes detrend and scale_by_freq only apply when mode is set to 'psd'.
   matplotlib.mlab.stride_windows(x, n, noverlap=None, axis=0)[source]

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.   Parameters

x1D array or sequence

Array or sequence containing the data.
nint

The number of data points in each window.
noverlapint, default: 0 (no overlap)

The overlap between adjacent windows.
axisint

The axis along which the windows will run.     References stackoverflow: Rolling window for 1D arrays in Numpy? stackoverflow: Using strides for an efficient moving average filter
   matplotlib.mlab.window_hanning(x)[source]

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

Another window algorithm.
   matplotlib.mlab.window_none(x)[source]

No window function; simply return x.  See also  window_hanning

Another window algorithm.


matplotlib.mlab.angle_spectrum(x, Fs=None, window=None, pad_to=None, sides=None)

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.  Parameters

x1-D array or sequence

Array or sequence containing the data
Fsfloat, default: 2

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

A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
sides{'default', 'onesided', 'twosided'}, optional

Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
pad_toint, optional

The number of points to which the data segment is padded when performing the FFT. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to the length of the input signal (i.e. no padding).    Returns

spectrum1-D array

The angle of the frequency spectrum (wrapped phase spectrum).
freqs1-D array

The frequencies corresponding to the elements in spectrum.      See also  psd

Returns the power spectral density.  complex_spectrum

Returns the complex-valued frequency spectrum.  magnitude_spectrum

Returns the absolute value of the complex_spectrum.  angle_spectrum

Returns the angle of the complex_spectrum.  phase_spectrum

Returns the phase (unwrapped angle) of the complex_spectrum.  specgram

Can return the complex spectrum of segments within the signal.


matplotlib.mlab.cohere(x, y, NFFT=256, Fs=2, detrend=<function detrend_none>, window=<function window_hanning>, noverlap=0, pad_to=None, sides='default', scale_by_freq=None)[source]

The coherence between x and y. Coherence is the normalized cross spectral density:  \[C_{xy} = \frac{|P_{xy}|^2}{P_{xx}P_{yy}}\]  Parameters
 x, y

Array or sequence containing the data
Fsfloat, default: 2

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

A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
sides{'default', 'onesided', 'twosided'}, optional

Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
pad_toint, optional

The number of points to which the data segment is padded when performing the FFT. This can be different from NFFT, which specifies the number of data points used. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to NFFT
NFFTint, default: 256

The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
detrend{'none', 'mean', 'linear'} or callable, default: 'none'

The function applied to each segment before fft-ing, designed to remove the mean or linear trend. Unlike in MATLAB, where the detrend parameter is a vector, in Matplotlib it is a function. The mlab module defines detrend_none, detrend_mean, and detrend_linear, but you can use a custom function as well. You can also use a string to choose one of the functions: 'none' calls detrend_none. 'mean' calls detrend_mean. 'linear' calls detrend_linear.
scale_by_freqbool, default: True

Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of Hz^-1. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
noverlapint, default: 0 (no overlap)

The number of points of overlap between segments.    Returns

Cxy1-D array

The coherence vector.
freqs1-D array

The frequencies for the elements in Cxy.      See also
psd(), csd()

For information about the methods used to compute \(P_{xy}\), \(P_{xx}\) and \(P_{yy}\).


matplotlib.mlab.complex_spectrum(x, Fs=None, window=None, pad_to=None, sides=None)

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.  Parameters

x1-D array or sequence

Array or sequence containing the data
Fsfloat, default: 2

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

A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
sides{'default', 'onesided', 'twosided'}, optional

Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
pad_toint, optional

The number of points to which the data segment is padded when performing the FFT. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to the length of the input signal (i.e. no padding).    Returns

spectrum1-D array

The complex-valued frequency spectrum.
freqs1-D array

The frequencies corresponding to the elements in spectrum.      See also  psd

Returns the power spectral density.  complex_spectrum

Returns the complex-valued frequency spectrum.  magnitude_spectrum

Returns the absolute value of the complex_spectrum.  angle_spectrum

Returns the angle of the complex_spectrum.  phase_spectrum

Returns the phase (unwrapped angle) of the complex_spectrum.  specgram

Can return the complex spectrum of segments within the signal.


matplotlib.mlab.csd(x, y, NFFT=None, Fs=None, detrend=None, window=None, noverlap=None, pad_to=None, sides=None, scale_by_freq=None)[source]

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.  Parameters

x, y1-D arrays or sequences

Arrays or sequences containing the data
Fsfloat, default: 2

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

A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
sides{'default', 'onesided', 'twosided'}, optional

Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
pad_toint, optional

The number of points to which the data segment is padded when performing the FFT. This can be different from NFFT, which specifies the number of data points used. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to NFFT
NFFTint, default: 256

The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
detrend{'none', 'mean', 'linear'} or callable, default: 'none'

The function applied to each segment before fft-ing, designed to remove the mean or linear trend. Unlike in MATLAB, where the detrend parameter is a vector, in Matplotlib it is a function. The mlab module defines detrend_none, detrend_mean, and detrend_linear, but you can use a custom function as well. You can also use a string to choose one of the functions: 'none' calls detrend_none. 'mean' calls detrend_mean. 'linear' calls detrend_linear.
scale_by_freqbool, default: True

Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of Hz^-1. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
noverlapint, default: 0 (no overlap)

The number of points of overlap between segments.    Returns

Pxy1-D array

The values for the cross spectrum \(P_{xy}\) before scaling (real valued)
freqs1-D array

The frequencies corresponding to the elements in Pxy      See also  psd

equivalent to setting y = x.    References Bendat & Piersol -- Random Data: Analysis and Measurement Procedures, John Wiley & Sons (1986)


matplotlib.mlab.detrend(x, key=None, axis=None)[source]

Return x with its trend removed.  Parameters

xarray or sequence

Array or sequence containing the data.
key{'default', 'constant', 'mean', 'linear', 'none'} or function

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.
axisint

The axis along which to do the detrending.      See also  detrend_mean

Implementation of the 'mean' algorithm.  detrend_linear

Implementation of the 'linear' algorithm.  detrend_none

Implementation of the 'none' algorithm.


matplotlib.mlab.detrend_linear(y)[source]

Return x minus best fit line; 'linear' detrending.  Parameters

y0-D or 1-D array or sequence

Array or sequence containing the data      See also  detrend_mean

Another detrend algorithm.  detrend_none

Another detrend algorithm.  detrend

A wrapper around all the detrend algorithms.


matplotlib.mlab.detrend_mean(x, axis=None)[source]

Return x minus the mean(x).  Parameters

xarray or sequence

Array or sequence containing the data Can have any dimensionality
axisint

The axis along which to take the mean. See numpy.mean for a description of this argument.      See also  detrend_linear

Another detrend algorithm.  detrend_none

Another detrend algorithm.  detrend

A wrapper around all the detrend algorithms.


matplotlib.mlab.detrend_none(x, axis=None)[source]

Return x: no detrending.  Parameters

xany object

An object containing the data
axisint

This parameter is ignored. It is included for compatibility with detrend_mean      See also  detrend_mean

Another detrend algorithm.  detrend_linear

Another detrend algorithm.  detrend

A wrapper around all the detrend algorithms.


classmatplotlib.mlab.GaussianKDE(dataset, bw_method=None)[source]

Bases: object Representation of a kernel-density estimate using Gaussian kernels.  Parameters

datasetarray-like

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).
bw_methodstr, scalar or callable, optional

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

datasetndarray

The dataset with which gaussian_kde was initialized.
dimint

Number of dimensions.
num_dpint

Number of datapoints.
factorfloat

The bandwidth factor, obtained from kde.covariance_factor, with which the covariance matrix is multiplied.
covariancendarray

The covariance matrix of dataset, scaled by the calculated bandwidth (kde.factor).
inv_covndarray

The inverse of covariance.     Methods
kde.evaluate(points) (ndarray) Evaluate the estimated pdf on a provided set of points.
kde(points) (ndarray) Same as kde.evaluate(points)     covariance_factor()[source]

   evaluate(points)[source]

Evaluate the estimated pdf on a set of points.  Parameters

points(# of dimensions, # of points)-array

Alternatively, a (# of dimensions,) vector can be passed in and treated as a single point.    Returns
 (# of points,)-array

The values at each point.    Raises

ValueErrorif the dimensionality of the input points is different

than the dimensionality of the KDE.
   scotts_factor()[source]

   silverman_factor()[source]


evaluate(points)[source]

Evaluate the estimated pdf on a set of points.  Parameters

points(# of dimensions, # of points)-array

Alternatively, a (# of dimensions,) vector can be passed in and treated as a single point.    Returns
 (# of points,)-array

The values at each point.    Raises

ValueErrorif the dimensionality of the input points is different

than the dimensionality of the KDE.


matplotlib.mlab.magnitude_spectrum(x, Fs=None, window=None, pad_to=None, sides=None)

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.  Parameters

x1-D array or sequence

Array or sequence containing the data
Fsfloat, default: 2

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

A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
sides{'default', 'onesided', 'twosided'}, optional

Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
pad_toint, optional

The number of points to which the data segment is padded when performing the FFT. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to the length of the input signal (i.e. no padding).    Returns

spectrum1-D array

The magnitude (absolute value) of the frequency spectrum.
freqs1-D array

The frequencies corresponding to the elements in spectrum.      See also  psd

Returns the power spectral density.  complex_spectrum

Returns the complex-valued frequency spectrum.  magnitude_spectrum

Returns the absolute value of the complex_spectrum.  angle_spectrum

Returns the angle of the complex_spectrum.  phase_spectrum

Returns the phase (unwrapped angle) of the complex_spectrum.  specgram

Can return the complex spectrum of segments within the signal.


matplotlib.mlab.phase_spectrum(x, Fs=None, window=None, pad_to=None, sides=None)

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.  Parameters

x1-D array or sequence

Array or sequence containing the data
Fsfloat, default: 2

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

A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
sides{'default', 'onesided', 'twosided'}, optional

Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
pad_toint, optional

The number of points to which the data segment is padded when performing the FFT. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to the length of the input signal (i.e. no padding).    Returns

spectrum1-D array

The phase of the frequency spectrum (unwrapped phase spectrum).
freqs1-D array

The frequencies corresponding to the elements in spectrum.      See also  psd

Returns the power spectral density.  complex_spectrum

Returns the complex-valued frequency spectrum.  magnitude_spectrum

Returns the absolute value of the complex_spectrum.  angle_spectrum

Returns the angle of the complex_spectrum.  phase_spectrum

Returns the phase (unwrapped angle) of the complex_spectrum.  specgram

Can return the complex spectrum of segments within the signal.


matplotlib.mlab.psd(x, NFFT=None, Fs=None, detrend=None, window=None, noverlap=None, pad_to=None, sides=None, scale_by_freq=None)[source]

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.  Parameters

x1-D array or sequence

Array or sequence containing the data
Fsfloat, default: 2

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

A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
sides{'default', 'onesided', 'twosided'}, optional

Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
pad_toint, optional

The number of points to which the data segment is padded when performing the FFT. This can be different from NFFT, which specifies the number of data points used. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to NFFT
NFFTint, default: 256

The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
detrend{'none', 'mean', 'linear'} or callable, default: 'none'

The function applied to each segment before fft-ing, designed to remove the mean or linear trend. Unlike in MATLAB, where the detrend parameter is a vector, in Matplotlib it is a function. The mlab module defines detrend_none, detrend_mean, and detrend_linear, but you can use a custom function as well. You can also use a string to choose one of the functions: 'none' calls detrend_none. 'mean' calls detrend_mean. 'linear' calls detrend_linear.
scale_by_freqbool, default: True

Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of Hz^-1. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
noverlapint, default: 0 (no overlap)

The number of points of overlap between segments.    Returns

Pxx1-D array

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

The frequencies corresponding to the elements in Pxx      See also  specgram

specgram differs in the default overlap; in not returning the mean of the segment periodograms; and in returning the times of the segments.  magnitude_spectrum

returns the magnitude spectrum.  csd

returns the spectral density between two signals.    References Bendat & Piersol -- Random Data: Analysis and Measurement Procedures, John Wiley & Sons (1986)


matplotlib.mlab.specgram(x, NFFT=None, Fs=None, detrend=None, window=None, noverlap=None, pad_to=None, sides=None, scale_by_freq=None, mode=None)[source]

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.  Parameters

xarray-like

1-D array or sequence.
Fsfloat, default: 2

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

A function or a vector of length NFFT. To create window vectors see window_hanning, window_none, numpy.blackman, numpy.hamming, numpy.bartlett, scipy.signal, scipy.signal.get_window, etc. If a function is passed as the argument, it must take a data segment as an argument and return the windowed version of the segment.
sides{'default', 'onesided', 'twosided'}, optional

Which sides of the spectrum to return. 'default' is one-sided for real data and two-sided for complex data. 'onesided' forces the return of a one-sided spectrum, while 'twosided' forces two-sided.
pad_toint, optional

The number of points to which the data segment is padded when performing the FFT. This can be different from NFFT, which specifies the number of data points used. While not increasing the actual resolution of the spectrum (the minimum distance between resolvable peaks), this can give more points in the plot, allowing for more detail. This corresponds to the n parameter in the call to fft(). The default is None, which sets pad_to equal to NFFT
NFFTint, default: 256

The number of data points used in each block for the FFT. A power 2 is most efficient. This should NOT be used to get zero padding, or the scaling of the result will be incorrect; use pad_to for this instead.
detrend{'none', 'mean', 'linear'} or callable, default: 'none'

The function applied to each segment before fft-ing, designed to remove the mean or linear trend. Unlike in MATLAB, where the detrend parameter is a vector, in Matplotlib it is a function. The mlab module defines detrend_none, detrend_mean, and detrend_linear, but you can use a custom function as well. You can also use a string to choose one of the functions: 'none' calls detrend_none. 'mean' calls detrend_mean. 'linear' calls detrend_linear.
scale_by_freqbool, default: True

Whether the resulting density values should be scaled by the scaling frequency, which gives density in units of Hz^-1. This allows for integration over the returned frequency values. The default is True for MATLAB compatibility.
noverlapint, default: 128

The number of points of overlap between blocks.
modestr, default: 'psd'

 What sort of spectrum to use:

 'psd'

Returns the power spectral density.  'complex'

Returns the complex-valued frequency spectrum.  'magnitude'

Returns the magnitude spectrum.  'angle'

Returns the phase spectrum without unwrapping.  'phase'

Returns the phase spectrum with unwrapping.        Returns

spectrumarray-like

2D array, columns are the periodograms of successive segments.
freqsarray-like

1-D array, frequencies corresponding to the rows in spectrum.
tarray-like

1-D array, the times corresponding to midpoints of segments (i.e the columns in spectrum).      See also  psd

differs in the overlap and in the return values.  complex_spectrum

similar, but with complex valued frequencies.  magnitude_spectrum

similar single segment when mode is 'magnitude'.  angle_spectrum

similar to single segment when mode is 'angle'.  phase_spectrum

similar to single segment when mode is 'phase'.    Notes detrend and scale_by_freq only apply when mode is set to 'psd'.


matplotlib.mlab.stride_windows(x, n, noverlap=None, axis=0)[source]

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.   Parameters

x1D array or sequence

Array or sequence containing the data.
nint

The number of data points in each window.
noverlapint, default: 0 (no overlap)

The overlap between adjacent windows.
axisint

The axis along which the windows will run.     References stackoverflow: Rolling window for 1D arrays in Numpy? stackoverflow: Using strides for an efficient moving average filter


matplotlib.mlab.window_hanning(x)[source]

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

Another window algorithm.


matplotlib.mlab.window_none(x)[source]

No window function; simply return x.  See also  window_hanning

Another window algorithm.


mpl_toolkits.mplot3d 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).
mplot3d FAQ How is mplot3d different from Mayavi? My 3D plot doesn't look right at certain viewing angles I don't like how the 3D plot is laid out, how do I change that?     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.   axes3d  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.     axis3d  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
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
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.


mpl_toolkits.mplot3d.art3d.get_dir_vector   mpl_toolkits.mplot3d.art3d.get_dir_vector(zdir)[source]

Return a direction vector.  Parameters

zdir{'x', 'y', 'z', None, 3-tuple}

The direction. Possible values are:  'x': equivalent to (1, 0, 0) 'y': equivalent to (0, 1, 0) 'z': equivalent to (0, 0, 1)
None: equivalent to (0, 0, 0) an iterable (x, y, z) is converted to a NumPy array, if not already     Returns

x, y, zarray-like

The direction vector.


mpl_toolkits.mplot3d.art3d.juggle_axes   mpl_toolkits.mplot3d.art3d.juggle_axes(xs, ys, zs, zdir)[source]

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.


mpl_toolkits.mplot3d.art3d.Line3D   classmpl_toolkits.mplot3d.art3d.Line3D(xs, ys, zs, *args, **kwargs)[source]

Bases: matplotlib.lines.Line2D 3D line object. Keyword arguments are passed onto Line2D().   draw(renderer)[source]

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).  Parameters

rendererRendererBase subclass.

   Notes This method is overridden in the Artist subclasses.
   get_data_3d()[source]

Get the current data  Returns

verts3dlength-3 tuple or array-like

The current data as a tuple or array-like.
   set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, dash_capstyle=<UNSET>, dash_joinstyle=<UNSET>, dashes=<UNSET>, data=<UNSET>, data_3d=<UNSET>, drawstyle=<UNSET>, fillstyle=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, marker=<UNSET>, markeredgecolor=<UNSET>, markeredgewidth=<UNSET>, markerfacecolor=<UNSET>, markerfacecoloralt=<UNSET>, markersize=<UNSET>, markevery=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, solid_capstyle=<UNSET>, solid_joinstyle=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, xdata=<UNSET>, ydata=<UNSET>, zorder=<UNSET>)[source]

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_3d_properties(zs=0, zdir='z')[source]

   set_data_3d(*args)[source]

Set the x, y and z data  Parameters

xarray-like

The x-data to be plotted.
yarray-like

The y-data to be plotted.
zarray-like

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

  Examples using mpl_toolkits.mplot3d.art3d.Line3D

   3D stem


draw(renderer)[source]

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).  Parameters

rendererRendererBase subclass.

   Notes This method is overridden in the Artist subclasses.


get_data_3d()[source]

Get the current data  Returns

verts3dlength-3 tuple or array-like

The current data as a tuple or array-like.


set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, dash_capstyle=<UNSET>, dash_joinstyle=<UNSET>, dashes=<UNSET>, data=<UNSET>, data_3d=<UNSET>, drawstyle=<UNSET>, fillstyle=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, marker=<UNSET>, markeredgecolor=<UNSET>, markeredgewidth=<UNSET>, markerfacecolor=<UNSET>, markerfacecoloralt=<UNSET>, markersize=<UNSET>, markevery=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, solid_capstyle=<UNSET>, solid_joinstyle=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, xdata=<UNSET>, ydata=<UNSET>, zorder=<UNSET>)[source]

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_data_3d(*args)[source]

Set the x, y and z data  Parameters

xarray-like

The x-data to be plotted.
yarray-like

The y-data to be plotted.
zarray-like

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


mpl_toolkits.mplot3d.art3d.Line3DCollection   classmpl_toolkits.mplot3d.art3d.Line3DCollection(segments, *args, zorder=2, **kwargs)[source]

Bases: matplotlib.collections.LineCollection A collection of 3D lines.  Parameters

segmentslist of array-like

A sequence of (line0, line1, line2), where: linen = (x0, y0), (x1, y1), ... (xm, ym)
 or the equivalent numpy array with two columns. Each line can have a different number of segments.
linewidthsfloat or list of float, default: rcParams["lines.linewidth"] (default: 1.5)

The width of each line in points.
colorscolor or list of color, default: rcParams["lines.color"] (default: 'C0')

A sequence of RGBA tuples (e.g., arbitrary color strings, etc, not allowed).
antialiasedsbool or list of bool, default: rcParams["lines.antialiased"] (default: True)

Whether to use antialiasing for each line.
zorderint, default: 2

zorder of the lines once drawn.
facecolorscolor or list of color, default: 'none'

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.  **kwargs

Forwarded to Collection.       do_3d_projection(renderer=<deprecated parameter>)[source]

Project the points according to renderer matrix.
   draw(renderer, project=<deprecated parameter>)[source]

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).  Parameters

rendererRendererBase subclass.

   Notes This method is overridden in the Artist subclasses.
   set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, array=<UNSET>, capstyle=<UNSET>, clim=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, cmap=<UNSET>, color=<UNSET>, colors=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, norm=<UNSET>, offset_transform=<UNSET>, offsets=<UNSET>, path_effects=<UNSET>, paths=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, segments=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, sort_zpos=<UNSET>, transform=<UNSET>, url=<UNSET>, urls=<UNSET>, verts=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]

Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha 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_segments(segments)[source]

Set 3D segments.
   set_sort_zpos(val)[source]

Set the position to use for z-sorting.

  Examples using mpl_toolkits.mplot3d.art3d.Line3DCollection

   3D stem


do_3d_projection(renderer=<deprecated parameter>)[source]

Project the points according to renderer matrix.


draw(renderer, project=<deprecated parameter>)[source]

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).  Parameters

rendererRendererBase subclass.

   Notes This method is overridden in the Artist subclasses.


set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, array=<UNSET>, capstyle=<UNSET>, clim=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, cmap=<UNSET>, color=<UNSET>, colors=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, norm=<UNSET>, offset_transform=<UNSET>, offsets=<UNSET>, path_effects=<UNSET>, paths=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, segments=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, sort_zpos=<UNSET>, transform=<UNSET>, url=<UNSET>, urls=<UNSET>, verts=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]

Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha 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_segments(segments)[source]

Set 3D segments.


set_sort_zpos(val)[source]

Set the position to use for z-sorting.


mpl_toolkits.mplot3d.art3d.line_2d_to_3d   mpl_toolkits.mplot3d.art3d.line_2d_to_3d(line, zs=0, zdir='z')[source]

Convert a 2D line to 3D.


mpl_toolkits.mplot3d.art3d.line_collection_2d_to_3d   mpl_toolkits.mplot3d.art3d.line_collection_2d_to_3d(col, zs=0, zdir='z')[source]

Convert a LineCollection to a Line3DCollection object.


mpl_toolkits.mplot3d.art3d.Patch3D   classmpl_toolkits.mplot3d.art3d.Patch3D(*args, zs=(), zdir='z', **kwargs)[source]

Bases: matplotlib.patches.Patch 3D patch object. The following kwarg properties are supported
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha unknown
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float     do_3d_projection(renderer=<deprecated parameter>)[source]

   get_path()[source]

Return the path of this patch.
   set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, capstyle=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]

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 or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float
   set_3d_properties(verts, zs=0, zdir='z')[source]


get_path()[source]

Return the path of this patch.


set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, capstyle=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]

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 or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float


mpl_toolkits.mplot3d.art3d.Patch3DCollection   classmpl_toolkits.mplot3d.art3d.Patch3DCollection(*args, zs=0, zdir='z', depthshade=True, **kwargs)[source]

Bases: matplotlib.collections.PatchCollection A collection of 3D patches. Create a collection of flat 3D patches with its normal vector pointed in zdir direction, and located at zs on the zdir axis. 'zs' can be a scalar or an array-like of the same length as the number of patches in the collection. Constructor arguments are the same as for PatchCollection. In addition, keywords zs=0 and zdir='z' are available. Also, the keyword argument depthshade is available to indicate whether or not to shade the patches in order to give the appearance of depth (default is True). This is typically desired in scatter plots.   do_3d_projection(renderer=<deprecated parameter>)[source]

   get_depthshade()[source]

   get_edgecolor()[source]

   get_facecolor()[source]

   set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, array=<UNSET>, capstyle=<UNSET>, clim=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, cmap=<UNSET>, color=<UNSET>, depthshade=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, norm=<UNSET>, offset_transform=<UNSET>, offsets=<UNSET>, path_effects=<UNSET>, paths=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, sort_zpos=<UNSET>, transform=<UNSET>, url=<UNSET>, urls=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]

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 array-like or scalar or None
animated bool
antialiased or aa or antialiaseds bool or list of bools
array array-like or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clim (vmin: float, vmax: float)
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
cmap Colormap or str or None
color color or list of rgba tuples
depthshade bool
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
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
visible bool
zorder float
   set_3d_properties(zs, zdir)[source]

   set_depthshade(depthshade)[source]

Set whether depth shading is performed on collection members.  Parameters

depthshadebool

Whether to shade the patches in order to give the appearance of depth.
   set_sort_zpos(val)[source]

Set the position to use for z-sorting.


set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, array=<UNSET>, capstyle=<UNSET>, clim=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, cmap=<UNSET>, color=<UNSET>, depthshade=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, norm=<UNSET>, offset_transform=<UNSET>, offsets=<UNSET>, path_effects=<UNSET>, paths=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, sort_zpos=<UNSET>, transform=<UNSET>, url=<UNSET>, urls=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]

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 array-like or scalar or None
animated bool
antialiased or aa or antialiaseds bool or list of bools
array array-like or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clim (vmin: float, vmax: float)
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
cmap Colormap or str or None
color color or list of rgba tuples
depthshade bool
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
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
visible bool
zorder float


set_depthshade(depthshade)[source]

Set whether depth shading is performed on collection members.  Parameters

depthshadebool

Whether to shade the patches in order to give the appearance of depth.


mpl_toolkits.mplot3d.art3d.patch_2d_to_3d   mpl_toolkits.mplot3d.art3d.patch_2d_to_3d(patch, z=0, zdir='z')[source]

Convert a Patch to a Patch3D object.


mpl_toolkits.mplot3d.art3d.patch_collection_2d_to_3d   mpl_toolkits.mplot3d.art3d.patch_collection_2d_to_3d(col, zs=0, zdir='z', depthshade=True)[source]

Convert a PatchCollection into a Patch3DCollection object (or a PathCollection into a Path3DCollection object).  Parameters
 za

The location or locations to place the patches in the collection along the zdir axis. Default: 0.  zdir

The axis in which to place the patches. Default: "z".  depthshade

Whether to shade the patches to give a sense of depth. Default: True.


mpl_toolkits.mplot3d.art3d.Path3DCollection   classmpl_toolkits.mplot3d.art3d.Path3DCollection(*args, zs=0, zdir='z', depthshade=True, **kwargs)[source]

Bases: matplotlib.collections.PathCollection A collection of 3D paths. Create a collection of flat 3D paths with its normal vector pointed in zdir direction, and located at zs on the zdir axis. 'zs' can be a scalar or an array-like of the same length as the number of paths in the collection. Constructor arguments are the same as for PathCollection. In addition, keywords zs=0 and zdir='z' are available. Also, the keyword argument depthshade is available to indicate whether or not to shade the patches in order to give the appearance of depth (default is True). This is typically desired in scatter plots.   do_3d_projection(renderer=<deprecated parameter>)[source]

   draw(renderer)[source]

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).  Parameters

rendererRendererBase subclass.

   Notes This method is overridden in the Artist subclasses.
   get_depthshade()[source]

   get_edgecolor()[source]

   get_facecolor()[source]

   set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, array=<UNSET>, capstyle=<UNSET>, clim=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, cmap=<UNSET>, color=<UNSET>, depthshade=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, norm=<UNSET>, offset_transform=<UNSET>, offsets=<UNSET>, path_effects=<UNSET>, paths=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, sizes=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, sort_zpos=<UNSET>, transform=<UNSET>, url=<UNSET>, urls=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]

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 array-like or scalar or None
animated bool
antialiased or aa or antialiaseds bool or list of bools
array array-like or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clim (vmin: float, vmax: float)
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
cmap Colormap or str or None
color color or list of rgba tuples
depthshade bool
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 unknown
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
sizes 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
visible bool
zorder float
   set_3d_properties(zs, zdir)[source]

   set_depthshade(depthshade)[source]

Set whether depth shading is performed on collection members.  Parameters

depthshadebool

Whether to shade the patches in order to give the appearance of depth.
   set_linewidth(lw)[source]

Set the linewidth(s) for the collection. lw can be a scalar or a sequence; if it is a sequence the patches will cycle through the sequence  Parameters

lwfloat or list of floats

   set_sizes(sizes, dpi=72.0)[source]

Set the sizes of each member of the collection.  Parameters

sizesndarray or None

The size to set for each element of the collection. The value is the 'area' of the element.
dpifloat, default: 72

The dpi of the canvas.
   set_sort_zpos(val)[source]

Set the position to use for z-sorting.


draw(renderer)[source]

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).  Parameters

rendererRendererBase subclass.

   Notes This method is overridden in the Artist subclasses.


set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, array=<UNSET>, capstyle=<UNSET>, clim=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, cmap=<UNSET>, color=<UNSET>, depthshade=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, norm=<UNSET>, offset_transform=<UNSET>, offsets=<UNSET>, path_effects=<UNSET>, paths=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, sizes=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, sort_zpos=<UNSET>, transform=<UNSET>, url=<UNSET>, urls=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]

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 array-like or scalar or None
animated bool
antialiased or aa or antialiaseds bool or list of bools
array array-like or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clim (vmin: float, vmax: float)
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
cmap Colormap or str or None
color color or list of rgba tuples
depthshade bool
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 unknown
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
sizes 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
visible bool
zorder float


set_linewidth(lw)[source]

Set the linewidth(s) for the collection. lw can be a scalar or a sequence; if it is a sequence the patches will cycle through the sequence  Parameters

lwfloat or list of floats


set_sizes(sizes, dpi=72.0)[source]

Set the sizes of each member of the collection.  Parameters

sizesndarray or None

The size to set for each element of the collection. The value is the 'area' of the element.
dpifloat, default: 72

The dpi of the canvas.


mpl_toolkits.mplot3d.art3d.PathPatch3D   classmpl_toolkits.mplot3d.art3d.PathPatch3D(path, *, zs=(), zdir='z', **kwargs)[source]

Bases: mpl_toolkits.mplot3d.art3d.Patch3D 3D PathPatch object. The following kwarg properties are supported
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha unknown
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float     do_3d_projection(renderer=<deprecated parameter>)[source]

   set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, capstyle=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]

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 or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float
   set_3d_properties(path, zs=0, zdir='z')[source]

  Examples using mpl_toolkits.mplot3d.art3d.PathPatch3D

   Draw flat objects in 3D plot


mpl_toolkits.mplot3d.art3d.pathpatch_2d_to_3d   mpl_toolkits.mplot3d.art3d.pathpatch_2d_to_3d(pathpatch, z=0, zdir='z')[source]

Convert a PathPatch to a PathPatch3D object.
  Examples using mpl_toolkits.mplot3d.art3d.pathpatch_2d_to_3d

   Draw flat objects in 3D plot


mpl_toolkits.mplot3d.art3d.Poly3DCollection   classmpl_toolkits.mplot3d.art3d.Poly3DCollection(verts, *args, zsort='average', **kwargs)[source]

Bases: matplotlib.collections.PolyCollection A collection of 3D polygons.  Note Filling of 3D polygons There is no simple definition of the enclosed surface of a 3D polygon unless the polygon is planar. In practice, Matplotlib fills the 2D projection of the polygon. This gives a correct filling appearance only for planar polygons. For all other polygons, you'll find orientations in which the edges of the polygon intersect in the projection. This will lead to an incorrect visualization of the 3D area. If you need filled areas, it is recommended to create them via plot_trisurf, which creates a triangulation and thus generates consistent surfaces.   Parameters

vertslist of (N, 3) array-like

Each element describes a polygon as a sequence of N_i points (x, y, z).
zsort{'average', 'min', 'max'}, default: 'average'

The calculation method for the z-order. See set_zsort for details.  *args, **kwargs

All other parameters are forwarded to PolyCollection.     Notes Note that this class does a bit of magic with the _facecolors and _edgecolors properties.   do_3d_projection(renderer=<deprecated parameter>)[source]

Perform the 3D projection for this object.
   get_edgecolor()[source]

   get_facecolor()[source]

   get_vector(segments3d)[source]

Optimize points for projection.
   set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, array=<UNSET>, capstyle=<UNSET>, clim=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, cmap=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, norm=<UNSET>, offset_transform=<UNSET>, offsets=<UNSET>, path_effects=<UNSET>, paths=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, sizes=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, sort_zpos=<UNSET>, transform=<UNSET>, url=<UNSET>, urls=<UNSET>, verts=<UNSET>, verts_and_codes=<UNSET>, visible=<UNSET>, zorder=<UNSET>, zsort=<UNSET>)[source]

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

   set_alpha(alpha)[source]

Set the alpha value used for blending - not supported on all backends.  Parameters

alphaarray-like or scalar or None

All values must be within the 0-1 range, inclusive. Masked values and nans are not supported.
   set_edgecolor(colors)[source]

Set the edgecolor(s) of the collection.  Parameters

ccolor or list of colors or 'face'

The collection edgecolor(s). If a sequence, the patches cycle through it. If 'face', match the facecolor.
   set_facecolor(colors)[source]

Set the facecolor(s) of the collection. c can be a color (all patches have same color), or a sequence of colors; if it is a sequence the patches will cycle through the sequence. If c is 'none', the patch will not be filled.  Parameters

ccolor or list of colors

   set_sort_zpos(val)[source]

Set the position to use for z-sorting.
   set_verts(verts, closed=True)[source]

Set 3D vertices.
   set_verts_and_codes(verts, codes)[source]

Set 3D vertices with path codes.
   set_zsort(zsort)[source]

Set the calculation method for the z-order.  Parameters

zsort{'average', 'min', 'max'}

The function applied on the z-coordinates of the vertices in the viewer's coordinate system, to determine the z-order.

  Examples using mpl_toolkits.mplot3d.art3d.Poly3DCollection

   Frontpage 3D example

   Custom hillshading in a 3D surface plot

   2D and 3D Axes in same Figure

   Generate polygons to fill under 3D line graph

   3D plots as subplots

   3D surface (colormap)

   3D surface (checkerboard)


do_3d_projection(renderer=<deprecated parameter>)[source]

Perform the 3D projection for this object.


get_vector(segments3d)[source]

Optimize points for projection.