Plotly.js: Scattergl traces with multiple colors set sometimes incorrectly format points in other scattergl traces

Created on 8 Nov 2018  路  6Comments  路  Source: plotly/plotly.js

see https://codepen.io/alexcjohnson/pen/JeXOGX?editors=1010

The large point above the line should be orange (as it is in the legend) but it ends up blue, taking its color from the previous trace.

Fiddling around with the settings, there seem to be various ways to trigger or avoid this behavior. See also https://codepen.io/donolingerPHX/pen/qQZdxE?editors=1010

Seems to have come in with v1.36.0 - perhaps #2499?

bug regression

Most helpful comment

Interesting. Let me have a look.

All 6 comments

Seems to have come in with v1.36.0

Good eye, both codepens work with v1.35.2:

In both cases, the options computed in scattergl/convert.js appear correct:

image

image

looking at [1].color.


perhaps #2499?

Yeah good eye, but maybe changes to regl-scatter2d that accommodate splom traces in https://github.com/plotly/plotly.js/pull/2505 are to blame too.

Here's the diff between the regl-scatter2d version used in 1.35.2 and 1.36.0:

https://github.com/gl-vis/regl-scatter2d/compare/f0d0cd35276e0df33e790a430a810620ad2af9c2...7e29a418b8b05ee2317ca311aa2944e3f6f25665

Here's my attempt: https://github.com/plotly/plotly.js/compare/scattergl-maxColors-4096 which uses https://github.com/plotly/plotly.js/compare/scattergl-maxColors-4096 - but unfortunately breaks the gl2d_scatter-color-clustering mock.


Ha, I think I know why Dima used maxColors=255, 255 is the largest integer that can be put in a Uint8Array which is below the maxTextureSize limit of what looks like 16384.

image

Doing this with 16 bits would give: (2**16-1) = 65535 which of course is > 16384

Well, 255 colors is for sure not enough. Looks like we could theoretically reach 16384 with just one WebGL texture. @archmoj would you be interested in looking at this further?

Interesting. Let me have a look.

Hey guys can we possibly create a problematic test case in regl-scatter2d mocks (after we merge https://github.com/gl-vis/regl-scatter2d/pull/15)?

maxColors=255 there is wrong, in fact that is 256 colors. But that is not the point - for the case when the trace has more than 255 colors regl-scatter2d just puts all of them into an attribute buffer directly, so all of the trace colors get displayed, none of them lost. That does not even cause memory overhead, because if we want to use big texture with color palette (more than 256x256), we have to use two Uint16s pointers for color id, but that is the same as single Uint32 color value, therefore having a long buffer with colors directly is valid solution.

The issue seems to be something different.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maxwell8888 picture maxwell8888  路  3Comments

archmoj picture archmoj  路  3Comments

emanuelsetitinger picture emanuelsetitinger  路  3Comments

jonmmease picture jonmmease  路  3Comments

bryaan picture bryaan  路  3Comments