How to Choose Colors for Your Data Visualizations
Color is a major factor in creating effective charts. A good set of colors will highlight the story you want the data to tell, while a poor one will hide or distract from a visualization’s purpose.
In this article, I’ll describe the types of color palette that are used in data visualization, provide some general tips and best practices when working with color, and highlight a few tools to generate and test color palettes for your own charts.
Types of color palette
Three major types of color palette exist for data visualization:
- Qualitative palettes
- Sequential palettes
- Diverging palettes
The type of color palette that you should use in a visualization depends on the nature of the data mapped to color.
A qualitative palette is used when the variable is categorical in nature. Categorical variables are those that take on distinct labels without inherent ordering. Examples include country or state, race, and gender. Each possible value of the variable is assigned one color from a qualitative palette.
In a qualitative palette, the colors assigned to each group need to be distinct. As a rule of thumb, you should try to limit the maximum palette size to 10 or fewer colors. With more colors than this, you start to run into trouble distinguishing between groups. If you have more possible values than colors, then you should try to bundle values together, like setting the smallest categories to a single “other” category. Looping through colors multiple times is a bad idea, as this can cause confusion.
The main way of generating distinctiveness between colors is through their hues. Additional variation can be obtained by adjusting lightness and saturation, but it’s a good idea not to make the differences too large. Too much difference might suggest that some colors are more important than others — though this can be useful when used deliberately. Avoid having two colors with the same…