码迷,mamicode.com
首页 > 其他好文 > 详细

【Matplotlib】使用速记

时间:2019-12-20 11:52:53      阅读:92      评论:0      收藏:0      [点我收藏+]

标签:ted   pyplot   class   eterm   mat   body   state   序列   imshow   

【持续更新】

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】使用速记

标签:ted   pyplot   class   eterm   mat   body   state   序列   imshow   

原文地址:https://www.cnblogs.com/ytxwzqin/p/12072028.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!