Skip to content

[BUG] Handle downsampling of Marker Symbol #354

Open
@SuperMrBlob

Description

@SuperMrBlob

Describe the bug 🖍️

A clear and concise description of what the bug is.

There is special handling to correctly downsample hovertext, marker_size, and marker_color. But we do not downsample marker symbol!

Reproducing the bug 🔍

Please provide steps & minimal viable code to reproduce the behavior.
Giving this information makes it tremendously easier to work on your issue!

A trace like this is incorrectly downsampled:

from plotly.subplots import make_subplots
import plotly.graph_objects as go

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

trace = go.Scatter(
    x=x,
    y=y,
    name='foobar',
    showlegend=True,
    mode='markers',
    marker={
        'symbol': np.where(x % 2 == 0, 'triangle-up', 'triangle-down'),
        'color': np.where(x % 3 == 0, 'green', np.where(x % 3 == 1, 'red', 'blue')),
        'size': 20
    }
)

from plotly_resampler import FigureResampler, FigureWidgetResampler

fig = go.Figure(trace).update_layout(height=700, width=1200)
z = FigureWidgetResampler(fig)
z

Expected behavior 🔧

Please give a clear and concise description of what you expected to happen.

When zooming in, marker symbol should be correctly displayed. Instead, when we zoom in, markers are randomly downsampled.

Screenshots 📸

If applicable, add screenshots to help explain your problem.

Panning around when zoomed in but still resampling causes these markers to change symbol randomly, e.g., see the two blue markers around x=18.6k

Image Image

Environment information: (please complete the following information)

  • Python environment:
    • Python version: 3.10
    • plotly-resampler environment: Jupyterlab, Chrome
  • plotly-resampler version: 0.10.0
  • plotly version: 5.24.1

Metadata

Metadata

Assignees

No one assigned

    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