-
Notifications
You must be signed in to change notification settings - Fork 197
quantile and threshold color scales #415
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
Conversation
|
we'll use the test plot in #419 |
|
I've added a build in https://observablehq.com/@fil/quantile-threshold-shaperendering-415-419 Here's a bug though: Threshold/quantile scales should accept ordinal schemes. Plot.dot(data, { x: "bill_length", y: "species", fill: "body_mass" }).plot({
color: {
type: "threshold",
domain: [2000, 3000],
scheme: "dark2"
}
})gives |
It did not work, because: - scaleThreshold relies on an ascending domain (and breaks if it's not ascending); let's check for this situation and reverse the scale if the domain is descending - scaleQuantile ignores the domain order
a975864 to
a596be5
Compare
|
For the diverging schemes (scheme11’s) you don’t get very good results with n = 2: you get the first two (red and gray in RdBu or red and yellow in RdYlBu). What you want is probably the outer two (red and blue). Maybe we can fix this in scheme11 for the n = 2 case. Line 153 in 4286100
|
|
The reason for the TypeError is that sometimes ordinalScheme returns an array (for the ordinal schemes) while other times it returns a function that will later be converted into an array when the domain is known: Lines 16 to 17 in 96d2f3f
So we either need to make sure ordinalScheme always returns a function, or we need to handle a returned array when we call ordinalScheme. I can fix. |


color: {type: "threshold", domain: [30, 50], range: ["red", "green", "blue"]}closes #372
color: {type: "quantile", scheme: "blues", quantiles: 7}closes #373
TODO
(still needs a few test plots)