How To Create Accessible Graphs For Colorblind People | by Caroline Arnold | Feb, 2024

Editor
2 Min Read


Including a Python color blindness simulator and appropriate color schemes

Image created by the author using Midjourney.

Color blindness, or more precisely color vision deficiency, affects up to 8% of men and 0.5% of women. The most common condition is red-green color blindness, a congenital disorder in which people lack the receptors for either red or green colors in their retinas. As a result, they cannot distinguish color pairs such as red and green, cyan and grey, and blue and purple.

It is important for data scientists to consider color-blind users when choosing color palettes for graphs. A significant proportion of users will have some form of color vision deficiency, and they may understand graphs differently than intended. In fact, I understood the importance of this when my direct supervisor was unable to read my line graphs, and it turned out that he had difficulty distinguishing between red and green.

In this article, I will share

  • A Python simulator for the most common forms of color blindness
  • An accessibility test for the default color palettes in matplotlib and seaborn
  • Creating accessible color palettes with ColorBrewer

What does color blindness look like?

Color vision is made possible by cone cells in the retina. There are three different types of cone cells that receive red, green, and blue light, respectively. People with red-green deficiency lack either the cones that detect red light or the cones that detect green light. Lack of both cones, leaving only the receptor for blue light, is rare, as is lack of the blue-receptive cone and total achromatopsia, the lack of all color receptors.

For those who can see all colors, it is difficult to imagine how a graph looks to a colorblind person. Color blindness simulators are useful tools for checking the accessibility of your graphics. The simulation in the following panel is made with the DaltonLens online color simulator, using the Brettel algorithm.

Share this Article
Please enter CoinGecko Free Api Key to get this plugin works.