plotly——比 matplotlib 更灵活的可视化库

在使用 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。不禁感叹相见恨晚。

posted @ 2024-01-25 21:18  倒地  阅读(284)  评论(0)    收藏  举报