Two Simple Steps to Create Colorblind-Friendly Data Visualizations

Your plot may be incomprehensible for many people. Here’s how to fix that.

CR Ferreira
Towards Data Science

--

Photo by Thomas Evans on Unsplash.

According to the Colorblind Awareness website, color vision deficiency affects approximately 8% of men and 0.5% of women in the world, which means that roughly 300 million people worldwide have some level of color blindness. When it comes to data visualization, careless choice of colors and graphical elements can make a chart ambiguous or even incomprehensible for many people.

In fact, not only colorblind people can have problems interpreting data plotted with carelessly-chosen color schemes. Common things like black-and-white printing or sunlight shining on a device screen may also affect the color perception of people with no color blindness.

Although there are various types of color blindness, creating data visualizations that can be easily comprehended by everyone is actually quite simple — it all comes down to making the right choices. Still, a huge amount of the content created nowadays is not colorblind friendly. Seemingly, the main problem is that most data scientists are still not used to consider this factor when designing their data visualizations.

Do you usually take color blindness into consideration when designing data visualizations? If you don’t, maybe you should start doing it. Here you will find a few simple tips that will help you create data visualizations that can be fully comprehended by everyone, regardless of color blindness conditions or external color-perception alterations.

Motivation: A seemingly normal chart may be incomprehensible for colorblind people

When I was working on my Ph.D., I often used Google Sheets to quickly generate temporary plots. But it turns out that the default color scheme for Google Sheets plots is not really colorblind friendly. This is how it looks like:

Fictional chart created with Google Sheets.

If you don’t have color blindness, you can probably distinguish between the five different data series in the chart. But let’s check how people with color blindness may see it. I’ve used Coblis — Color Blindness Simulator to simulate how people with eight different variations of color blindness would perceive this image. You can check the result below. (The name of each simulated condition can be found in the figure captions.)

First: Protanomaly (red-weak). Second: Deuteranomaly (green-weak). Created with Google Sheets and Coblis.
First: Tritanomaly (blue-weak). Second: Protanopia (red-blind). Created with Google Sheets and Coblis.
First: Deuteranopia (green-blind). Second: Tritanopia (blue-blind). Created with Google Sheets and Coblis.
First: Achromatopsia. Second: Blue cone monochromacy. Created with Google Sheets and Coblis.

In some of those simulations, it is very hard or even impossible to distinguish between the different colors used for the different data series, making this chart completely incomprehensible for many people. Actually, it will be also incomprehensible for anyone who sees it on a black-and-white printout.

Step 1: Pick the right colors

So the question now is: is it possible to pick colors that can be easily distinguished by everyone, regardless of color blindness? Given that there are so many different color blindness conditions, that is probably not an easy task. A general recommendation is to avoid problematic color combinations, like red/green, green/brown, green/blue, blue/gray, etc.

But luckily other people have already gone through this process and figured out color combinations that work well for most colorblind people, so you don’t have to do it all by yourself. You can search online for such combinations and use the ones that you like the best. There are even some online tools that can help you pick a colorblind-friendly color scheme depending on your requirements, like ColorBrewer and Coolors.

I’ve used ColorBrewer to pick a better color scheme for my example chart above. This is a great tool that generates color schemes considering various user-selected criteria, including colorblind-friendliness. I asked it to create color schemes with five diverging colorblind-safe, print-friendly colors. This is the one I chose:

New plot with colors suggested by ColorBrewer. Colors used: #d73027, #fc8d59, #fee090, #91bfdb, #4575b4. Created with Google Sheets and Coblis.

And here are the results of the colorblind simulations with Coblis:

First: Protanomaly (red-weak). Second: Deuteranomaly (green-weak). Created with Google Sheets and Coblis.
First: Tritanomaly (blue-weak). Second: Protanopia (red-blind). Created with Google Sheets and Coblis.
First: Deuteranopia (green-blind). Left: Tritanopia (blue-blind). Created with Google Sheets and Coblis.
First: Achromatopsia. Second: Blue cone monochromacy. Created with Google Sheets and Coblis.

This is much better, right? It is possible to easily distinguish between the five colors in almost all scenarios. The only exception is the simulation of achromatopsia, which is a condition that affects roughly 1 in 30,000 people. People with complete achromatopsia can’t perceive any colors and will find it nearly impossible to distinguish A from E and B from D in this plot. Again, the same can be also be said about anyone who prints this plot in black and white.

Although the color scheme used above does not work well for all color blindness conditions, it’s still possible to come up with color schemes that do. You will find that most of them are monochromatic palettes, composed of different intensities of a single color. Here is one example of such a palette, also generated with ColorBrewer:

Colorblind-friendly palette generated with ColorBrewer. Source: ColorBrewer.

However, while this approach can be safely used for five different colors as in this example, the color intensities can become increasingly similar to each other if you need to use more color variations. This may be a problem even for people that don’t have color blindness.

This shows that, while using a colorblind-friendly palette can make it substantially easier for most people to comprehend your data visualization, it may still not be a perfect solution. In general, it is not recommended to encode information using only variations in colors, even if they are accessible colors. That’s why you also need Step 2.

Step 2: Use different shapes, patterns, textures or labels

The best way to ensure that people will be able to fully comprehend your plot is to eliminate the need for distinguishable colors altogether, by using something else to differentiate the data series in it. (This doesn’t mean that you shouldn’t care about which colors you use in your plot — you should do this in addition to using a colorblind-friendly palette, just in case.)

For instance, we could easily improve the chart above by using different shapes for each data series, like this:

Using different shapes for different data series. Created with Google Sheets.

With this design, we can be sure that colorblind readers will have full comprehension of the plotted data, regardless of their specific conditions. Even if for some reason someone prints this chart using strictly black and white (no shades of gray), the chart will still be unambiguous.

For other types of plots, there are other strategies you can use. For line plots, you can use different line patterns and/or varying line widths, in addition to different colors. Unfortunately I couldn’t find out how to use dashed or dotted line patterns in Google Sheets, but I’ve often done it with LaTeX/PGFPlots and Python/Matplotlib, so I am sure that other widely used plotting software support them as well. Here’s an example created with Matplotlib:

Using different line patterns in a line plot. Created with Matplotlib.

For bar or pie charts, I recommend applying different fill textures. Again, I couldn’t find this option on Google Sheets, but many of the most popular plotting software probably support it. Here’s a real example I created a few years ago (using PGFPlots):

Using different fill textures in a bar chart. Created with PGFPlots.

If for some reason you can’t use different shapes, patterns, or textures in your plot, consider adding labels to the data series (provided that you have enough space for that). The most important thing is to ensure that everyone will be able to understand the data you are plotting.

Summary

The main reason why many people are still creating colorblind-unfriendly data visualizations is not that it is hard to avoid but actually because they may have never thought about it in the first place. Once we are aware of it and are intentional in creating accessible charts, it is actually quite simple. Basically, it comes down to two things:

  1. Choose a colorblind-friendly palette: online tools like ColorBrewer and Coolors make it very easy to find an appropriate color scheme nowadays. You can also use an online color blindness simulator like Coblis to check how your plot may look like to other people.
  2. But don’t rely only on colors: add different geometrical shapes, line patterns, fill textures or even labels to your plots. This will improve readability for everyone, including people that don’t have color blindness.

Acknowledgments

I am thankful to the creators of the free tools I’ve used to create the examples shown in this article, namely: Coblis, ColorBrewer, Google Sheets, Matplotlib and PGFPlots (I have no affiliation with any of them).

Disclosure: This post contains one or more links from the Amazon Services LLC Associates Program. As an affiliate, I get commissions for purchases made through those links, at no extra cost to the customer.

--

--

Ph.D. in Computer Science and software developer, but may occasionally write about other topics.