plotly_resampler
enables visualizing large sequential data by adding resampling functionality to Plotly figures.
In this Plotly-Resampler demo over 110,000,000
data points are visualized!
pip | pip install plotly-resampler |
---|
To add dynamic resampling to your plotly Figure, you should;
- wrap the constructor of your plotly Figure with
FigureResampler
- call
.show_dash()
on the Figure
(OPTIONAL) add the trace data as hf_x
and hf_y
(for faster initial loading)
import plotly.graph_objects as go; import numpy as np
from plotly_resampler import FigureResampler
x = np.arange(1_000_000)
noisy_sin = (3 + np.sin(x / 200) + np.random.randn(len(x)) / 10) * x / 1_000
fig = FigureResampler(go.Figure())
fig.add_trace(go.Scattergl(name='noisy sine', showlegend=True), hf_x=x, hf_y=noisy_sin)
fig.show_dash(mode='inline')
- Convenient to use:
- just add the
FigureResampler
decorator around a plotly Figure consructor and call.show_dash()
- allows all other ploty figure construction flexibility to be used!
- just add the
- Environment-independent
- can be used in Jupyter, vscode-notebooks, Pycharm-notebooks, as application (on a server)
- Interface for various downsampling algorithms:
- ability to define your preffered sequence aggregation method
- When running the code on a server, you should forward the port of the
FigureResampler.show_dash
method to your local machine. - In general, when using downsamplingm one should be aware of (possible) aliasing effects.
The [R] in the legend indicates when the corresponding trace is being resampled (and thus possibly distorted) or not.
- Add downsampler methods that take aliasing into account
- Parallelize the resampling
👤 Jonas Van Der Donckt, Jeroen Van Der Donckt, Emiel Deprost