Scattergl plot is sometimes slow to interact with even with moderate number of points
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 18.3k
- Forks
- 2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 28
Description
With constant number of points and other settings, I see that Scattergl rendering times vary a lot. With 100,000 points, there are cases where it is virtually impossible to interact with the plot (e.g. zoom), and just moving the mouse seem to cause lengthy calculations.
For example, the following code from the doc works well:
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.show()
but if I replace the x data by zeros,
x = np.zeros(N),
performance is significantly degraded (so much that using Scatter instead of Scattergl becomes better when trying to zoom in a box).
Any ideas where the difference is coming from and how performance could be improved in this case?
Thanks.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Scattergl example from the linked large-data-sets documentation and reproduce it with 100,000 random x values, then with x set to zeros. Compare zoom-box and mouse interaction performance between the two cases and determine what behavior needs to change; done means the degenerate x data no longer causes the reported lengthy interaction delays.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data-visualization, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100