plotly.py icon indicating copy to clipboard operation
plotly.py copied to clipboard

ScatterGL webGL scatter flickers while scroll zooming starting at Plotly==5.17.0

Open wygud opened this issue 2 years ago • 4 comments

Plotly 5.17 scatterGL plot flickers when scroll zooming in and out. This happens inside a dash app. I have not tried to replicate it in any other way.

fig = go.Figure(
        layout={
            'autosize': True,
            'dragmode': 'pan',
            'yaxis':{"showgrid": False,},
            'xaxis':{"showgrid": False,},
        }
    ).add_trace(go.Scattergl(mode = "lines",)
)

wygud avatar Nov 23 '23 20:11 wygud

hi @sirdinkus I am not sure I was able to replicate your issue. Zooming into the page with scroll zooming tries to fit the complete graph into the page. If I use the zoom icon (send from left), I don't see any glitches.

Are you trying to avoid the usage of the zoom icon?

image

import plotly.graph_objects as go
import numpy as np

N = 100000
fig = go.Figure(data=go.Scattergl(
    x = np.random.randn(N),
    y = np.random.randn(N),
    mode='markers',
    marker=dict(
        color=np.random.randn(N),
        colorscale='Viridis',
        line_width=1
    )
))
fig.update_layout(autosize=True,dragmode= 'pan')
fig.update_xaxes(showgrid=False)
fig.update_yaxes(showgrid=False)

fig.show()

Coding-with-Adam avatar Nov 24 '23 19:11 Coding-with-Adam

Hey @Coding-with-Adam , Sorry forgot to mention the dcc.Graph config has 'scrollZoom': True. So perhaps it is a bug that only presents itself when using Dash? This allows the user to use their mouse wheel to zoom in and out on the dataset. Think like when you want to manually navigate around a largish dataset.

looks something like this:

config = {
     'scrollZoom': True,     
     'autosizable': True,
     'doubleClick': 'autosize',
     'displayModeBar': 'hover',  
     'displaylogo': False,
     'staticPlot': False,    
     'showTips': True,       
     'showLink': False,
     'showAxisDragHandles': True,
     'showAxisRangeEntryBoxes': True,  
}
layout = dmc.MantineProvider(
    children=[
           dcc.Graph(
                id='scatterGL-graph',
                figure=fig,
                config=config,
            ),
     ]
)

plotly==5.17.0 with the bug: plotly_5_17

plotly==5.16.0 without the bug: plotly_5_16

wygud avatar Nov 24 '23 20:11 wygud

I see. @sirdinkus can you please provide me the full code+data that you use for your example so I can replicate the bug?

When I try it with Scattergl, mode='markers', I don't get this bug. I'm hoping this bug is limited to markers='lines'.


from dash import Dash, html, dash_table, dcc
import plotly.graph_objects as go
import numpy as np


N = 100000
fig = go.Figure(data=go.Scattergl(
    x = np.random.randn(N),
    y = np.random.randn(N),
    mode='markers',
    marker=dict(
        color=np.random.randn(N),
        colorscale='Viridis',
        line_width=1
    )
))
fig.update_layout(autosize=True,dragmode= 'pan')
fig.update_xaxes(showgrid=False)
fig.update_yaxes(showgrid=False)


config = {
     'scrollZoom': True,     
     'autosizable': True,
     'doubleClick': 'autosize',
     'displayModeBar': 'hover',  
     'displaylogo': False,
     'staticPlot': False,    
     'showTips': True,       
     'showLink': False,
     'showAxisDragHandles': True,
     'showAxisRangeEntryBoxes': True,  
}
app = Dash(__name__)
app.layout = html.Div([

    dcc.Graph(figure=fig, id='graph1', config=config)
])


if __name__ == '__main__':
    app.run(debug=True)

Coding-with-Adam avatar Nov 27 '23 17:11 Coding-with-Adam

@Coding-with-Adam Its part of a very bloated/fragile multipage app so I will replicate with single page dash app and send when I get a moment.

wygud avatar Nov 27 '23 17:11 wygud

Hi - we are tidying up stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for a while, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. If you'd like to submit a PR, we'd be happy to prioritize a review, and if it's a request for tech support, please post in our community forum. Thank you - @gvwilson

gvwilson avatar Jul 11 '24 22:07 gvwilson