-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix color clustering #2377
Fix color clustering #2377
Conversation
package.json
Outdated
@@ -100,7 +100,7 @@ | |||
"regl": "^1.3.1", | |||
"regl-error2d": "^2.0.3", | |||
"regl-line2d": "^2.1.4", | |||
"regl-scatter2d": "^2.1.13", | |||
"regl-scatter2d": "^2.1.16", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you update the package-lock file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
src/traces/scattergl/index.js
Outdated
}); | ||
|
||
scene.fill2d.update(scene.fillOptions); | ||
scene.fill2d.update(fillOptions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forgot to git add
the json mock corresponding to gl2d_line_select.png
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the one that accidentally made it into master, as mentioned above
By accident pushed 41c067a to master, this should fix that.
But since I had that in master as the base of my own PR, I removed it there #2379 (comment)
@@ -863,9 +863,11 @@ function plot(container, subplot, cdata) { | |||
|
|||
fillOptions.opacity = trace.opacity; | |||
fillOptions.positions = pos; | |||
|
|||
return fillOptions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you briefly explain why this fixes #2376 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That fixes #2354. That is internal regl-line2d
behavior: when we do line2d.update([opts1, undefined, opts2, ...rest])
, the second line in batch is ignored instead of being removed. I made it accept null
, indicating that batch item should be removed.
src/traces/scattergl/index.js
Outdated
@@ -781,9 +781,9 @@ function plot(container, subplot, cdata) { | |||
} | |||
// fill requires linked traces, so we generate it's positions here | |||
if(scene.fill2d) { | |||
scene.fillOptions.forEach(function(fillOptions, i) { | |||
var fillOptions = scene.fillOptions.map(function(fillOptions, i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a jasmine test to 🔒 this down?
@alexcjohnson that is regl limitation of |
package-lock.json
Outdated
@@ -10260,115 +10238,6 @@ | |||
"update-diff": "1.1.0" | |||
} | |||
}, | |||
"regl-scatter2d": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this gone?
package-lock.json
Outdated
"version": "0.44.0", | ||
"resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.44.0.tgz", | ||
"integrity": "sha512-vMeZaLXjG1B1BKOD9HB11sb9UIUvbzXWJu0NR38j9Uyp1h5xUXqh1Rqe+EhxQp3jzlHIv/LVhFKCJjQQKA2LoA==", | ||
"version": "0.44.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not bump mapbox-gl
in this PR?
Makes sense, but we need to do something reasonable in this case (which should be well within the range that scattergl is expected to support), and not have it break like this. My eyes can't distinguish 65k colors, so we should be able to find a way to discretize the colors to fit within that limit. |
@alexcjohnson fixed by d604a76 |
Beautiful! Here's 1M points now, looks lovely. Is there an obvious way to test this? I wouldn't want to make a mock with 100k or more points in it, is there a way to trigger the difference at a lower volume? Or perhaps draw something like this programmatically (but not random like in my test) and read a few pixels? |
- this locks down commit: gl-vis/regl-scatter2d@6138fd7
21ce74e
to
7cb3295
Compare
|
||
for(var i = 0; i < N; i++) { | ||
x.push(i); | ||
color.push(Math.random()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe I'm being paranoid, but I still don't like random
in tests. Can we do something repeatable like
plotly.js/src/traces/box/plot.js
Lines 17 to 30 in ce5bc97
var randSeed = 2000000000; | |
function seed() { | |
randSeed = 2000000000; | |
} | |
function rand() { | |
var lastVal = randSeed; | |
randSeed = (69069 * randSeed + 1) % 4294967296; | |
// don't let consecutive vals be too close together | |
// gets away from really trying to be random, in favor of better local uniformity | |
if(Math.abs(randSeed - lastVal) < 429496729) return rand(); | |
return randSeed / 4294967296; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha right. Good call!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
randSeed = 2000000000; | ||
}; | ||
|
||
lib.pseudoRandom = function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea - I bet we'll find other places this should be used too.
Merging master 1154589 includes the commit where I 🔪 |
- partly fixes #2386
Good 👁️ with commit f8b4e52 we get: Some weird things happened on CI during this push, so I decided to bump @dfcreative anything else you may want to add to this PR? |
@etpinard so far looks great, thanks a lot for helping out! 💃 |
That fixes #2376, #2374 and #2354.
By accident pushed 41c067a to master, this should fix that.
cc @alexcjohnson @etpinard