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

fig.show() does not upsample graph on zoom in #227

Closed Broundal closed 1 year ago

Broundal commented 1 year ago

Hi,

In the following code (copied from README.md) 2 figures are plotted - one with fig.show() and another with fig.show_dash(). While the latter produces the expected graph, the graph produced in the first option does not upscale when zooming in. In other words, zoom in will show you the down-sampled version. Thanks in advance!

import plotly.graph_objects as go; import numpy as np
from plotly_resampler import FigureResampler, FigureWidgetResampler

x = np.arange(1_000_000)
noisy_sin = (3 + np.sin(x / 200) + np.random.randn(len(x)) / 10) * x / 1_000

# OPTION 2 - FigureResampler: dynamic aggregation via a Dash web-app
fig = FigureResampler(go.Figure())
fig.add_trace(go.Scattergl(name='noisy sine', showlegend=True), hf_x=x, hf_y=noisy_sin)

fig.show()          # incorrect
fig.show_dash() # correct
jonasvdd commented 1 year ago

Hi @Broundal,

I think the highlighted section of the README (see 📷 ⬇️; unfolds when you click on it), should bring some clarification on the differences between show and show_dash of the FigureResampler class.

image

Please let me know if something remains unclear!

Cheers, Jonas

Broundal commented 1 year ago

I have indeed missed this part in the Readme file. Thanks for pointing that out!