I am trying to re-work some jupyter
notebooks using plotly
instead of matplotlib
. My original function is
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)
I can't see a simple way to add such vertical lines (or other markup) in plotly
.
I found this on using the cufflinks pandas integration. Although the function name is the same (iplot
) it doesn't seem to be any relation.
I also saw this similar question. All I could think was "surely there's a simpler way"... Is there?