You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been trying to update a plot containing scattergl traces dynamically with Plotly.react.
However, I've found that in some cases, some of the points are missing and I get a "glDrawElements: attempt to access out of range vertices in attribute 0" error in the console.
a) Create a plot with a single scattergl trace with N points (with Plotly.newPlot)
b) Update this plot to instead contain a scattergl trace with M points (with Plotly.react)
In the final plot, the trace has many points not rendering for me (on up-to-date Chrome 71.0.3578.98).
This issue is unusual in that it seems to depend on the precise number of points in each trace. I've done some experiments, and it seems like it only occurs when (N > 10,000) and (M <= 10,000), which makes me think that perhaps arrays are being handled differently based on their size and something incompatible is resulting.
I know a different Plotly.react + scattergl issue was reported before, but that one seemed to be a bit different.
Thanks for reporting this. This could be similar and maybe related to a fix for #2882.
My ongoing investigation on #2882 showed that when a function that returns the data is passed (instead of data) the react function tries to make a full update which cause problems for regl traces.
Seems better? Though it's hard to tell! My original code-pen seems to not have the issue now either which makes me wonder if something changed in the browser too?
Actually, yeah, it's just hard to tell with the 100k-point threshold. If you zoom into a smaller region (e.g., a 0.2 x 0.2 square) then the difference is apparent in the older code-pen example.
However, in the new example posted by @archmoj it appears to be fixed! Probably a better demo to compare would be something that puts points on a regular grid so that it would be easy to see if points are missing.
Great! Yes, with this it's very apparent. If you run it with:
N=100,010
M=90,000
For example, it looks good in the updated code. In the older version (with plotly 1.43.1) it looks fine initially, but if you zoom in you can see whole segments of the spiral that get dropped out.
Activity
archmoj commentedon Jan 7, 2019
Thanks for reporting this. This could be similar and maybe related to a fix for #2882.
My ongoing investigation on #2882 showed that when a function that returns the data is passed (instead of data) the react function tries to make a full update which cause problems for
regltraces.etpinard commentedon Jan 7, 2019
Could be related to #2334 also.
Thanks very much for the report!
joshua-gould commentedon Feb 1, 2019
Is there any additional changes I need to make to change Plotly.react to Plotly.newPlot in https://github.com/plotly/react-plotly.js/blob/master/src/factory.js as a workaround for this bug? Thanks.
deto commentedon Feb 1, 2019
I didn't want to take the performance hit of newPlot vs react, so I wrote a test a choose which one to call based on the data sizes.
With this test function to determine which to use:
Seems to have worked so far - haven't noticed the behavior since adding this. And most of the time its not triggered (and so Plotly.react) is used.
deto commentedon Mar 7, 2019
Due to PR #3578 this issue seems to now revolve around 100k points instead of 10k points.
For example, use my codepen above. Run it once with N=100001, M=100001. The points will saturate the area.
Then run it again with N=100001, M=90001 and there will be many many less points (much more than just a 10% reduction).
copy of https://github.com/plotly/react-plotly.js/blob/master/src/fac…
archmoj commentedon Oct 30, 2019
@deto
Possible fix demo i.e. using different build.
deto commentedon Oct 30, 2019
Seems better? Though it's hard to tell! My original code-pen seems to not have the issue now either which makes me wonder if something changed in the browser too?
archmoj commentedon Oct 30, 2019
@deto I noticed missing points on your example at https://codepen.io/anon/pen/JwvEgE.
Could you please confirm if it is fixed in the above demo?
Thank you!
deto commentedon Oct 30, 2019
Actually, yeah, it's just hard to tell with the 100k-point threshold. If you zoom into a smaller region (e.g., a 0.2 x 0.2 square) then the difference is apparent in the older code-pen example.
However, in the new example posted by @archmoj it appears to be fixed! Probably a better demo to compare would be something that puts points on a regular grid so that it would be easy to see if points are missing.
archmoj commentedon Oct 30, 2019
@deto Good call. Here is a demo on the grid.
deto commentedon Oct 30, 2019
Great! Yes, with this it's very apparent. If you run it with:
N=100,010
M=90,000
For example, it looks good in the updated code. In the older version (with plotly 1.43.1) it looks fine initially, but if you zoom in you can see whole segments of the spiral that get dropped out.
Nice work! Hope your changes get merged in soon.
archmoj commentedon Oct 31, 2019
Closed by #4323 .