predict-idlab / plotly-resampler

Visualize large time series data with plotly.py
https://predict-idlab.github.io/plotly-resampler/latest
MIT License
1k stars 67 forks source link

Saving plotly-resampler object for faster viewing #246

Closed vinay-hebb closed 10 months ago

vinay-hebb commented 1 year ago

I am plotting large time series array and it takes considerable time to plot. Currently, I am loading the data and passing it to resampler which resamples and plots. My understanding is that resampling code is taking time.

Is it possible to save the plotly resampler object (first time) so that I can load the object and view plot faster for future use?

jvdd commented 1 year ago

Hey @vinay-hebb,

Thx for submitting this issue. I observe the following questions in this issue;

A. Can you save plotly-resampler figures? B. Can you view the plot faster?


A.

You can save Plotly-Resampler figures by serializing it.

fig_to_save = ...  # some plotly-resampler figure

# Save the figure (pickle it)
pickle.dump(fig_to_save, open("saved_fig.pkl", "wb"))
del fig_to_save  # you can delete the plotly-resampler figure

# Load the figure
fig_loaded = pickle.load(open("saved_fig", "rb"))

B.

Saving & loading should not result in faster downsample (as plotly-resampler is stateless).

Can you provide some more details;

Feel free to submit some minimal working code on how you currently create your plots :)


Hope this answers your questions.

Cheers, Jeroen

jonasvdd commented 10 months ago

I will close this issue for now.