Comments (6)
The thing is, you’re never going to want more than 10 hues for categorical colors.* You might get more than that if you vary lightness as well, such as category20 which pairs light and dark, and category20b and category20c which have four shades per hue. But then you have to be careful about the semantic association caused by the grouping.
So, I find that in practice a handful of hand-picked hues are going to outperform automatic selection. I can see that sometimes it’s nice to start with a different set of hues if you want to match a particular aesthetic. But it’s rare that you want to pick equidistant hues in HCL or some such, since the hand-picked ones are often going to look better and perform at least as well.
*Just like you’re never going to want more than 640KB.
from d3-color.
Thank you for your thoughts on this. You make very good points.
I think I'll close this issue then, as it seems like the idea of automatically picking N colors is more of an academic curiosity than a practical need.
from d3-color.
@mbostock @curran As I have run into the need for more than 10, I decided to comment on this issue.
Here is the case: I need 20 colors for 20 topics that were created by LDA. I have limited my soft topics to 20 because I wanted to use 20 or 20c as my scale. Now here is my problem: with 20 topics:
If I had more than 20 colors, I would certainly upgrade the limit to 25 or 30.
Any thoughts as to what extent can we actually have distinct colors?
I am creating a custom scale but your feedback would be much appreciated.
from d3-color.
@armandidandeh I did something rather crazy and generated a color scale with something like 200 different hues, like this:
export default scaleOrdinal()
.domain(allCountries)
.range(allCountries.map((country, i) => {
const t = i / allCountries.length;
return hcl(t * 360, 50, 70);
}));
From https://github.com/unhcr/dataviz-streamgraph-explorer/blob/master/src/colorScale.js
It worked OK, but probably you can't differentiate all of them.
Tamara Munzner says a good rule of thumb is not more than 12 colors, from Visualization Analysis and Design.
from d3-color.
@curran thanks for the input. Agreed but 12 is not realistic.
I once did something very similar to your code using a hypercube idea a few years back but as you said, not very practical as well.
from d3-color.
after a bit of thinking the algorism should be considering colors as a simi cone
its topmost point is black
its base circle is hue
the most bottom point of the cup is white
the diameter of the hue circle equals the distance from black to white
...
when ever you come near the base center the color becomes lighter
when ever you move towards the top of the cone the color becomes darker
the algorism should pick up n points in this simi cone, farest from each other
...
in the beginnig it will be easy, picking the top most point(black), and some of the base points
...
but after a while, you will need to go upwards to distripute fine your colors using the whole body of, colors like black, navy, dark red, maroon and so on
...
this can be done manualy from the pie i learned from you, and i added to it a tooltip
from d3-color.
Related Issues (20)
- d3.rgb doesn't parse HSL hues with `deg` units HOT 1
- Changing color.s changes luminosity and color.l saturation.
- Security vulnerability fix for d3-color required in version 2.x HOT 7
- Security vulnerability fix for d3-color nice-to-have in version 1.x HOT 4
- Unexpected token 'export' while update from 2.x.x to 3.x.x HOT 2
- Why d3 uses illuminant D50 instead of D65? HOT 1
- d3.hsl doesnt seem to work with grey scale values HOT 2
- Alpha value of 0 breaks rgb HOT 1
- Add formatHex8() to include opacity HOT 7
- Brightening black in RGB HOT 3
- bug: hue is NaN when convert hsl HOT 2
- Unexpected conversion to HSL
- Incorrect conversion from HCL / LCH to hex or rgb HOT 2
- oklab / oklch? HOT 8
- More exports. HOT 9
- Doesn't work - color is not defined HOT 1
- Does the Common JS version of the module work? HOT 1
- Supporting CSS color level 4 HOT 3
- Avoid catastrophic backtracking when parsing HOT 11
- formatHex with alpha channel HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from d3-color.