Skip to content

Limit discrete categorical colors

badcolor and encodingmechanicalWilke 2019 p. 234Knaflic 2015 p. 97Few 2012 p. 246Few 2012 p. 247Few 2012 p. 75Munzner 2014 p. 226Munzner 2014 p. 228Munzner 2014 p. 229

Which continents dominate the top 10 countries by GDP per capita?

Plotly Express Gapminder dataset, top 10 countries by GDP per capita in 2007.

“Use direct labeling instead of colors when you need to distinguish between more than about eight categorical items”

Claus O. Wilke, "Fundamentals of Data Visualization", p. 234.

Also covered in Knaflic 2015 (4 focus your audience's attention, p. 97), Few 2012 (10 COMPONENT-LEVEL GRAPH DESIGN, p. 246), Few 2012 (10 COMPONENT-LEVEL GRAPH DESIGN, p. 247), Few 2012 (5 VISUAL PERCEPTION AND GRAPHICAL COMMUNICATION, p. 75), Munzner 2014 (10 Map Color and Other Channels, p. 226), Munzner 2014 (10 Map Color and Other Channels, p. 228), Munzner 2014 (10 Map Color and Other Channels, p. 229).

CVD preview

Before

Ten separate colors assign a unique hue to every country bar and force repeated visual lookup without conveying continent grouping.

Download before Python code

After

Three Okabe-Ito continent hues and direct bar values replace the 10-color palette so readers see European, Asian, and American leaders at once.

Download after Python code

Values

Norway leads at 49,357 USD, followed by Kuwait at 47,307 USD and Singapore at 47,143 USD.

Values used in both charts
CountryContinentGDP per capita (USD)
NorwayEurope49357
KuwaitAsia47307
SingaporeAsia47143
United StatesAmericas42952
IrelandEurope40676
Hong Kong, ChinaAsia39725
SwitzerlandEurope37506
NetherlandsEurope36798
CanadaAmericas36319
IcelandEurope36181