I was wondering if there was any kind of guidance on when to use go.Scatter and when to use go.Scattergl? Is there a cutoff of number of data points when one is better than the other? Any other consideration on choosing on or the other? Or just try and see?
(I’d like to automatically choose the right one for my explainerdashboard package where users can pass any size dataset, large or small, so I need to automate the choice)
scattergl is faster but it’s rendered with webgl instead of svg. svg are vector graphics and so they look better when exported. some journals, publications, and websites will only publish vector graphics. also, some small portion of web users are on web browsers or computers that don’t have a gpu or have disabled webgl for security reasons.
you will definitely notice a difference around 10k points. there are fundamental limits with svg and the number of elements that can be rendered to the DOM, so anything above 20k points is pretty slow / technically impossible to render with svg. that’s why we rewrote some of these chart types in webgl
The only downside I found of using go.Scattergl is that the browser may have a limit of GL contexts that it can display at once. See this issue. You may get it to work on Chrome by launching the app from the command line with the --max-active-webgl-contexts argument to specify explicitly the maximum number of WebGL contexts, but it’s definitely less convenient. But if you stick to 8 graphs or less on the same page, you should not run into that issue.