在使用 plotly 后,我抛弃了 matplotlib。
import numpy as np
import plotly.graph_objects as go
from scipy import signal
x = np.linspace(0, 1, 1000)
chebwin_window = signal.windows.chebwin(len(x), at=90)
hann_window = signal.windows.hann(len(x))
trace_chebwin = go.Scatter(x=x, y=chebwin_window, name='chebwin')
trace_hann = go.Scatter(x=x, y=hann_window, name='hann')
layout = go.Layout(title='Window Functions', xaxis=dict(title='Time'), yaxis=dict(title='Amplitude'))
fig = go.Figure(data=[trace_chebwin, trace_hann], layout=layout)
fig.show()
绘制的图像操作空间更大,缩放与拖动更符合直觉,支持 Jupyter Notebook。不禁感叹相见恨晚。
标签:hann,trace,matplotlib,window,可视化,plotly,go,chebwin From: https://www.cnblogs.com/chirp/p/17988204