Grayscale Testing Graphs
TL;DR: Because of printers and colorblindness the color palette of your chart, graph, or data visualization must work in grayscale.
While we analytics nuts were conducting research on color schemes most appropriate for a data visualization for one of our clients, I happened to enter the phrase, “colors to use in charts” into Google.
At the time I write this, Google has this feature that tries to guess what the answer is for you, and shares an excerpt as the first result. It’s a feature I love, as long as the result is right.
Unfortunately, in this case, the first result was not great.
When I first saw this I was excited. I thought, “Perfect! Here are the color codes I need and everything!” Then I clicked and visited the blog post where this information came from, read it in more detail, and found a big glaring problem.
To be fair, I wholeheartedly agree with the spirit of the post. The spirit and initial message from this post boil down to “don’t use the default color scheme,” whether programs like Excel or Google Sheets, or specific charting platforms and libraries. It is extremely rare that the default color palette will be the best choice for your presentation.
While I agree with the spirit of the author’s post, the practical advice was unfortunately poor. The author’s heart was in the right place. I liked the effort the author went through to figure out the RGB values of colors printed in a book on the topic. The problem is that the colors provided fail the “Grayscale Test.”
The Grayscale Test
I doubt they teach the “Grayscale Test” at “Infographics University.” As far as I know, this is just a fancy term I made up for checking how a chart looks when converted from its full color to grayscale.
In the blog post I criticize above, I found this image that the author provided to feature how the optimized color palette looks in a pie chart.
Besides the fact that the author used a pie chart (grumble, grumble), allow me to demonstrate why this is a bad color palette. To do this, let’s use the Grayscale Test.
The Grayscale Test is simple and you can perform it in a number of ways:
An easy one is to simply print the chart on paper using the grayscale setting for your printer. It’s a little wasteful of ink and paper but is fairly easy to do.
Use whatever program you have on your computer for viewing images to desaturate the image, or set the saturation setting to zero. For example, in Mac OS X I can open a PNG file like this in Preview, and click Tools > Adjust Color, and on the pop-up window that appears I set the saturation level to the lowest setting to make the image gray.
Here is what it looks like when I do desaturation on my computer:
As you can see, desaturating the chart shows how poorly it can survive without color. One problem with this approach is that the image quality is still pretty good, and much more forgiving than the other methods.
Filter it with a browser extension.
Another option is to use a browser extension, for instance, this Grayscale Black & White extension for Chrome. This is my preferred method. This extension, in particular, is also less forgiving. Here’s a screenshot of what this image looks like using this tool:
No matter what the method, the point is this. If your work is successful and others want to look at the chart you made, then it could end up reaching people in a variety of ways. One of those ways is very likely to be a colorless one. Without color, does your chart:
a) convey as much information as it did with color,
b) lose some information but is still worth looking at, or
c) become a waste of space?
Why This Matters
If you think this is not a concern in our modern age, here are a few reasons why this is an important test for you to make:
- Your chart may be printed on paper and in grayscale. Newspapers, books and other types of ink-on-dead-trees mediums will rarely print charts contained in color. They save money by printing the pages in black and white—including graphics.
- It’s unknown how many people have trouble differentiating colors. The NIH reported that among those with North European Ancestry, as many as 8% of men and 0.5% of women have the common form of red-green color blindness. No numbers were reported for the rarer forms of blue-yellow and complete colorblindness or those of other genetic ancestries.
- It’s becoming increasingly common to use apps that use devices that alter the color settings. For instance, to protect against blue light problems, Flux is used at night by many, but it makes nuance contrasts difficult to see.
I love to read books published by O’Reilly media, and many of them cover topics related to visualizing information and include charts. Like most publishers, the content inside of these books is not in color but black and white. This is true even for the digital copies of many of their books. It is sad to see charts that I know the authors spent time on to make beautiful and clearly used color in an interesting way, but that color was stripped of the images before the work was published.
Given that the authors I read are often experts in data science, and generate charts and graphs on a daily basis, I’m disturbed that so few of them pass the Grayscale Test.
Here are some parting words to end with:
- Pie charts are the worst. Don’t ever use a pie chart. I regret picking that blog post as an example because I truly want to avoid promoting pie charts, even accidentally.
- Reorganize the chart to use fewer colors. If you need to use so many colors to convey the basic attribute of your chart, consider whether there is a better approach to organizing and presenting the data. Using nine different colors like in the example just looks obnoxious, visually.
- Considering using hue and saturation to add another dimension. Using color as a method for labeling items on a legend might not only be redundant — it may miss out on a colorful opportunity to enrich your chart. If you remove the need for using the color in order to identify basic information on your chart, it frees up the use of color for adding an additional data point. For instance in a bar chart that labels the data on an x-axis, and the size of the pie as the y-axis, you can add a third dimension that is represented with density, with black being the maximum value and the other lesser values represented with lighter shades of gray.
- Further reading. There is fantastic, free information online on how to effectively communicate information through color (hue, lightness, and saturation). I would check out the work that already went into creating the color palettes used in libraries like Seaborn, ggplot, and matplotlib, and others. I also highly recommend this 6-part series on the use of color for this purpose. It’s a wonderful read, with great examples for illustration. Have fun!