One of the five core guidelines in my data visualization work is what I call “Integrating the Graphics and Text.” In Better Data Visualizations, I quote Amanda Cox—recently on the podcast—who once said, “The annotation layer is the most important thing we do…otherwise it’s a case of ‘here it is, you go figure it out.’”
In the book, I outline three main strategies to better integrate text into your graphics:
- Remove legends and place labels directly on your chart;
- Use active, concise titles; and
- Add useful annotations to guide interpretation and highlight key insights.
When it comes to integrating legends into your graphs, I typically show a simple dot plot and offer a few options (beyond the default of a legend floating somewhere out in space):
- Place the labels above the dots;
- Add color to the labels above the dots (my preferred approach); and
- Color-code the labels in the title/subtitle.
It’s this last option—coloring labels in the title—that I’ve often been hesitant about.
There are real accessibility concerns when color is used as the only visual cue to link title text to chart elements. The technique introduces multiple colors into a block of text, which can easily become muddy and difficult to read, especially depending on font weight and color contrast.
With all of that being said, I found this diverging bar chart in the Washington Post last week that has made me reconsider. The chart shows the projected 10-year impact of six key components in the recent House GOP spending bill. On the one side, extending the 2017 tax cuts, increasing the standard tax deduction, and increasing the child tax credit will increase the national debt by a total of $4.3 trillion. On the other side, changes in student loan policy, rescinding climate change money, and cutting Medicaid will decrease the national debt by $1.8 trillion.
The data are grouped into two color-coded categories—“costers” and “savers” in the budget lingo. The same two colors also appear in the title—not as the sole indicator, but as a redundant encoding. The direction and length of the bars already carries the main meaning, and the colors imply reinforce it.
(Also before you ask—my testing shows that the red and green colors are consistent for readers with color vision deficiencies. But even if they hadn’t, the colors are not critical to understanding the chart.)
I think this leaves me in a new, good place for recommending when to use colors in the title for your legend: Use color in the title when it reinforces categories already made clear through other visual cues—like bar direction or grouping. When done right, this technique can add clarity without sacrificing accessibility. It also helps keep the viewer form having to jump between the chart and legend.