Skip to content

[BUG] Resample does not dynamically update on zoom with subplots #322

@auxym

Description

@auxym

Describe the bug 🖍️
I believe this is similar to #242, which should be fixed. However I am using the latest plotly-resampler version installed by pip (0.10.0) and still experiencing the issue. #242 is also about multiple traces in a single plot (no subplots), this issue concerns specifically subplots.

When using subplots with the plotly.subplots.make_subplots function, when zooming in, only the first subplot gets dynamically resampled on zoom.

Reproducing the bug 🔍
Here is a minimal code example, to be run in Jupyter:

import pandas as pd

import numpy as np

import plotly.graph_objects as go

from plotly.subplots import make_subplots

from plotly_resampler import register_plotly_resampler, unregister_plotly_resampler

register_plotly_resampler(mode="widget")

n = 2_000_000
x = np.arange(n)
x_time = pd.date_range("2020-01-01", freq="1s", periods=len(x))
noisy_sine = (3 + np.sin(x / 2000) + np.random.randn(n) / 10) * x / (n / 4)

fig = make_subplots(rows=2, cols=1)
fig.add_trace(go.Scatter(y=noisy_sine + 2, name="yp2"), row=1, col=1)
fig.add_trace(go.Scatter(y=noisy_sine - 3, name="ym1"), row=1, col=1)
fig.add_trace(go.Scatter(y=noisy_sine + 2, name="yp2"), row=2, col=1)
fig.add_trace(go.Scatter(y=noisy_sine - 3, name="ym1"), row=2, col=1)

print(type(fig))
display(fig)

Expected behavior 🔧
When zooming in on the first subplot (row=1), dynamic resampling works as expected. When zooming in on the second subplot, dynamic resampling does not work. I expected dynamic resampling to work the same on all subplots.

Environment information: (please complete the following information)

  • OS: Windows 11
  • Python environment:
    • Python version: 3.12
    • plotly-resampler environment: Jupyterlab on Firefox
  • plotly-resampler version: 0.10.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions