【发布时间】:2017-03-03 03:56:09
【问题描述】:
我正在尝试使用plotly 而不是matplotlib 重新处理一些jupyter 笔记本。我原来的功能是
def plot_power_spectrum(y):
ps = np.abs(np.fft.fft(y - np.mean(y)))**2
time_step = 1.0/6 # hours
freqs = np.fft.fftfreq(y.size, time_step)
idx = np.argsort(freqs)
plt.plot(freqs[idx], ps[idx])
plt.axvline(2*np.pi/168.0, color="magenta", alpha=0.4, lw=5)
plt.axvline(-2*np.pi/168.0, color="magenta", alpha=0.4, lw=5)
我看不到在plotly 中添加此类垂直线(或其他标记)的简单方法。
我发现 this 在使用袖扣 pandas 集成。虽然函数名称相同(iplot),但似乎没有任何关系。
我还看到了this similar question。我能想到的只是“肯定有更简单的方法”......有吗?
【问题讨论】:
标签: python matplotlib jupyter-notebook plotly