question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

scattergl triggers WebGL errors when using arrays of symbol, color, or size

See original GitHub issue

I’m experimenting with the Plotly.js scattergl chart, and seem to be running into issues when trying to use arrays of symbols, colors, and sizes to allow per-point styling.

Take a look at this fiddle.

When using only a single symbol, size or color, the chart renders fine. But if you comment out the single size and color (lines 48-49), and comment in the use of arrays of values, WebGL dies and the following is shown in the console:

GL_INVALID_OPERATION : glGenSyncTokenCHROMIUM: fence sync must be flushed before generating sync token

[.CommandBufferContext]GL ERROR :GL_OUT_OF_MEMORY : BackFramebuffer::Destroy: <- error from previous GL command

WebGL: CONTEXT_LOST_WEBGL: loseContext: context lost

The same thing happens in Firefox as well.

Does scattergl not allow for arrays of values for symbol, style and color? Is there some other way of setting styles on each point that I’m not aware of?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:22 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
brian428commented, Sep 26, 2016

Just curious if there was any ETA on when this might be addressed (or if it’s probably not coming any time soon)? It seems like allowing a hook for a render function might be a decent short-term option? Basically, it would leave it up to the developer to determine how to create the formatting configuration for each point (and how to optimize that decision process).

I’m not sure how the WebGL piece of Plotly.js is currently implemented, but I noticed that Three.js seems to handle this sort of thing pretty well. They have a “particle” demo that shows a lot of “points” of varying sizes and colors (https://threejs.org/examples/#webgl_points_random). And seems to keep memory use quite low:

three_js_particle_example

The downside is that Three.js seems to be a very low-level option, so I imagine that trying to wrap it within Plotly.js wouldn’t be a simple task. No idea if that’s worth exploring, but just thought I’d mention it.

1reaction
dycommented, Aug 24, 2016

That is the issue of gl-scatter2d-fancy, actually. We can reproduce it in this example by changing POINT_COUNT to 1e5.

That happens because plotly sees array of colors for markers and switches renderer from gl-scatter2d, which is performant one, to gl-scatter2d-fancy, which can style individual markers better.

Fancy scatter creates additional colorBuffer, storing values per marker vertex. Each value takes additional 32bits per item, or 1Gb+ of graphic card memory for 1e5 points.

As a possible solution would be using compressed textures for colors, instead of buffer. Or trying to filter repeating colors. Or just reconsider the need in that many colors.

Also consider FloatArrays length limit, which varies, but <= 2³², or practically < 1e8.

Though it will not remove performance lags of plotly, even comparing with gl-scatter2d standalone.

Read more comments on GitHub >

github_iconTop Results From Across the Web

plotly.graph_objects.Scattergl — 5.11.0 documentation
Bubble charts are achieved by setting marker.size and/or marker.color to a numerical arrays. Parameters. arg – dict of properties compatible with this ...
Read more >
React-Plotly: Graph Not Displaying Data From Array
I'm using scattergl because I have a big set of data points to display. I need help with this issue. I'm using react.js...
Read more >
plotly.js-dist-min | Yarn - Package Manager
Ready-to-use minified plotly.js distributed bundle. Contains trace modules bar , barpolar , box , candlestick , carpet , choropleth , choroplethmapbox ...
Read more >
Plotly - Quick Guide - Tutorialspoint
The tickfont property is a dict object specifying font name, size, color, etc. ... Plotly you can implement WebGL with Scattergl() in place...
Read more >
Changelog - Apache ECharts
[Fix] [svg] Normalize color when using SVG renderer to support more cases. ... Support trigger mouse event on polyline and polygon area.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found