# Colorblind-Friendly Diagrams

July 6, 2020

According to the National Institutes of Health, around 1 in 12 males and 1 in 200 females have some form of color vision deficiency. I will admit that until recently I have not thought about the implications of this on my work. But many of us, especially in research, use colors in diagrams to communicate ideas. And as much as we like to associate abstract concepts with colors (e.g. "good is green, bad is red"), it might backfire on us. I will borrow an example from a 2002 paper by Okabe and Ito [1]. Imagine that you submit a manuscript to a journal and it is then sent to three male reviewers (which even today is not unrealistic in some fields). The probability that at least one of them is colorblind is ~23%1.

Does this mean we should avoid using colors in our diagrams and instead utilize patterns and symbols? Not necessarily. If we are smart about it, we can design colorful diagrams that are accessible to colorblind people.

## The Nature of Colorblindness

In most cases, colorblind people can still see colors, though usually in a limited range. Human eyes have three special types of cells that are sensitive to mainly red, green and blue light [1]. Each cell type is associated with a gene; if one of those genes mutates, it changes how we perceive colors. Most colorblind people have problems with either the "red" or the "green" gene. A much rarer occurrence is people with a mutated "blue" gene. People with mutated "red", "green" and "blue" genes are said to have protanopia, deuteranopia and tritanopia, respectively [1].

## Types of Palettes

When designing diagrams, there are three main types of color palettes that you might use: sequential, diverging and categorical. Sequential and diverging palettes are usually used for continuous variables (like temperature) and can be constructed using just one or two main colors, in addition to a neutral color (e.g. black, gray or white), by producing a gradient. Categorical palettes, on the other hand, are used either for data that are discrete in nature or to differentiate between different categories. In most cases, palettes of this type have more colors. Because of this, I will focus on categorical palettes—they represent a more general case and so the findings will also be applicable to sequential and diverging palettes where fewer unique colors are needed.

## The Problem with Plotting Software

Whatever plotting software you use, the chances are it might not be optimized for colorblind people by default.

I do most of my programming in Python and so naturally I use matplotlib library for plotting any experimental or simulation results. Unfortunately, the default color cycle used by matplotlib for categorical data is not colorblind-friendly and this issue is known. In the image below, using this online tool, I simulated how matplotlib's color cycle would appear to people with the three types of colorblindness. We can see that especially people with protanopia and deuteranopia might find it challenging to distinguish between some of the colors. One of the main issues here might be the fact that matplotlib uses a lot of them. The more colors one wants to add to a palette, the more difficult it becomes to find a set of colors that are easy to distinguish, especially when you want to make the palette colorblind-friendly.

Back in 2014, MATLAB introduced a new default color cycle. Because they had gotten rid of the bright red, I assumed this new palette is colorblind-friendly. However, while researching for this blog post I could not find any official information on their website and after I simulated how their default color cycle is perceived by colorblind people (in the image below), I am no longer so sure anymore. Although it is better than matplotlib's default colors, it seems to me that people with protanopia and deuteranopia might find it difficult to distinguish between colors 2 and 5—they would be perceived as having almost identical hue and similar brightness (or at least that is what my eyes are telling me...).

## A Better Palette

Color palette that I have now adopted is the one by Okabe and Ito. It seems to have been popularized by Bang Wong's Nature Methods column in 2011 [2]. In the image below, you can see the original palette and simulations of how it is perceived by people with colorblindness. It is not perfect—for example, colors 2 and 7 might look quite similar to people with protanopia, but at least there is a noticeable difference in brightness, which is larger than in the MATLAB example. Also, people with tritanopia might find it difficult to differentiate between some of the colors. However, tritanopia is order of magnitudes rarer than, for example, protanopia, so that might be a reasonable compromise.

RGB and CMYK color code values for Okabe & Ito palette are listed below. The palette also includes black color which could be considered cheating as it would be distinguishable in all color palettes... Personally, I use it only if necessary and have thus set it as my eighth (instead of first) color because I want to distinguish diagram elements from the text, which is usually typed in black. However, in most cases, you do not even need that many different colors, so that is not an issue.

ColorRGB (0-255)CMYK (0-100)
Black0, 0, 00, 0, 0, 100
Orange230, 159, 00, 50, 100, 0
Sky blue86, 180, 23380, 0, 0, 0
Bluish green0, 158, 11597, 0, 75, 0
Yellow240, 228, 6610, 5, 90, 0
Blue0, 114, 178100, 50, 0, 0
Vermilion213, 94, 00, 80, 100, 0
Reddish purple204, 121, 16710, 70, 0, 0

## Final Remarks

Although I provide some recommendations, this blog post is not meant to be a complete guide to preparing colorblind-friendly diagrams. Whatever you use for plotting—whether it is Excel, ggplot2, matplotlib, MATLAB or something else—you should familiarize yourself with the capabilities and limitations of these tools. Some plotting software does not implement colorblind-friendly palettes by default but still offers them to the users. For example, matplotlib does not implement a colorblind-friendly palette in its default color cycle, but provides the option to use sequential, diverging and categorical palettes that are accessible to people with color vision deficiencies.

Even if your software does not offer any colorblind-friendly palettes, there are a lot of online tools that you might find useful. For example, this tool, which I mentioned previously, allows you to simulate how any image is perceived by people with color vision deficiencies. It can be used to make sure that your diagrams are accessible to colorblind people, though have in mind that every simulation has its limitations. You can also try out this tool which allows to build sequential, diverging and categorical palettes that are colorblind-friendly.

Whether by using built-in functionality of your software or by employing external tools, you should consider colorblind readers when designing your diagrams. Not only is it the right thing to do, but it will also make your work more impactful—after all, more people will be able to understand it.

## References

1. M. Okabe and K. Ito, How to make figures and presentations that are friendly to color blind people, University of Tokyo, 2002.
2. B. Wong, Points of view: Color blindness, Nature Methods, vol. 8, no. 6, p. 441, 2011. doi:10.1038/nmeth.1618

1. $1 - \left( 1 - 1/12 \right)^3 \approx 0.23 = 23\%$ ↩︎