Navio: categorical palettes

Most colour schemes hold about ten colours, and d3.scaleOrdinal starts again when it runs out — so an eleventh category is drawn in exactly the colour of the first, silently. Navio's default palette carries 50, chosen to stay distinguishable for readers with colour blindness. The data below is nutrients.csv, whose group column has 25 categories.

Pick a palette — each one is a single assignment:



    
Click a column header to sort by it. Sorted by group, each category is one solid band. Sorted by calories, the same categories scatter into single-pixel stripes. For a chart drawing one line per record, how the rows are ordered does more for legibility than which colours you pick.

navio.palettes holds the built-ins, and any function of the category count works too:

nv.defaultColorCategorical = navio.palettes.mokole;  // an array
nv.defaultColorCategorical = navio.palettes.turbo;   // a function of n
nv.defaultColorCategorical = (n) => d3.quantize(d3.interpolateCool, n);

How they measure up

Every number is the closest pair in the palette — the two colours a reader is most likely to confuse. Below 2.3 is under the just-noticeable difference, and shown in red: at that point two categories are the same colour in practice. Protanopia, deuteranopia and tritanopia are simulated with Viénot, Brettel & Mollon (1999), and Worst is the lowest of the four — the one that matters, because you do not get to pick your readers.

Named is mean naming saliency from the C3 model of Heer & Stone (CHI 2012): how reliably a reader can put a word to a colour, which is how people actually refer to a legend. Distance says the colours look different; this says you can ask someone about one of them. The count beside it is how many fall below the 0.2 the paper calls naming confusion.

ΔE00 is the modern standard and what Heer & Stone use; ΔE*ab is plain Euclidean distance in CIELAB, which they warn is unreliable exactly here, across the whole space. Both are shown because they disagree. The numbers are generated by npm run palettes, which also writes the shipped palettes, so the table and the library cannot drift apart.

The full write-up — how the default was chosen and what was rejected — is in docs/ai/COLOR-CATEGORICAL.md.