Matplotlib使用速记
Posted ytxwzqin
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Matplotlib使用速记相关的知识,希望对你有一定的参考价值。
【持续更新】
pyplot
matplotlib.pyplot
is a state-based interface to matplotlib. It provides a MATLAB-like way of plotting.
画图。常用:
import matplotlib.pyplot as plt
specgram
直接输入原始数据,可以画频谱图。
matplotlib.pyplot.
specgram
(x, NFFT=None, Fs=None, Fc=None, detrend=None, window=None, noverlap=None, cmap=None, xextent=None, pad_to=None, sides=None, scale_by_freq=None, mode=None, scale=None, vmin=None, vmax=None, *, data=None, **kwargs)
input parameters |
x | 1-D array or sequence 数组或序列 |
Fs | scalar 标量. The default value is 2. | |
window | callable or ndarray | |
sides | {‘default‘, ‘onesided‘, ‘twosided‘} | |
pad_to | 执行TTF填充的点数,默认none,此时等于NFFT。 | |
NFFT | FFT点数,2的指数最好,默认值256。不能被用作zero padding。可以用pad_to代替。 | |
detrend | {‘none‘, ‘mean‘, ‘linear‘} or callable, default ‘none‘ | |
scale_by_freq |
{bool, optional}. The default is True for MATLAB compatibility. The parameters detrend and scale_by_freq do only apply when mode is set to ‘psd’. |
|
mode | {‘default‘, ‘psd‘, ‘magnitude‘, ‘angle‘, ‘phase‘}. Default is ‘psd‘. | |
scale | {‘default‘, ‘linear‘, ‘dB‘} | |
cmap | A matplotlib.colors.Colormap instance; if None, use default determined by rc |
|
xextent | None or (xmin, xmax) |
output parameters |
spectrum | 2-D array. Columns are the periodograms of successive segments. |
freqs | 1-D array. The frequencies corresponding to the rows in spectrum. | |
t | 1-D array. The times corresponding to midpoints of segments (i.e., the columns in spectrum). | |
im | instance of class AxesImage . The image created by imshow containing the spectrogram |
Compute and plot a spectrogram of data in x. Data are split into NFFT length segments and the spectrum of each section is computed. The windowing function window is applied to each segment, and the amount of overlap of each segment is specified with noverlap. The spectrogram is plotted as a colormap (using imshow).
colormap
https://matplotlib.org/tutorials/colors/colormaps.html
以上是关于Matplotlib使用速记的主要内容,如果未能解决你的问题,请参考以下文章