Search code examples
d3.jscolorsscale

d3.scale.category10() + d3 + other color categories


Can anyone explain the different color categories available in d3?

And is my understanding correct? I am currently using this d3.scale.category10(); but this only gives me 10 colors and then starts reusing the colors after the 10th object. My thinking is I can use d3.scale.category20b(); to give 20 different colors to 20 different objects. But is there any other color categories available? And what is the difference between 20b and 20c?

These are the ones I have found so far: d3.scale.category10(); d3.scale.category20b(); d3.scale.category20c();


Solution

  • If you look at the (very well documented) d3 github page, you can see the actual colors for each of the predefined color scales.

    You could also take a look at this SO question for how to define your own.