Visual Perception and Data Visualization

In the field of data visualization, why do we care so much about visual perception? Does it really matter when creating charts and graphs? The answer is a resounding yes; it does matter, and hopefully this one very simple example will demonstrate why it matters.

Below are two chart legends taken from data visualizations done in Tableau. The first is from a data visualization done by Kelly Martin, and the second is from my own crime visualization, both available for download on Tableau Public. First, let me emphatically state that I am not picking on Kelly. In fact, my primary reason for using her visualization as an example is to give an additional shout out to her for her incredibly well-done visualization on bird strikes that can be found here.


In both of these examples, notice how the legend bar appears to be a different size at each end. The light ends appear to be wider than the dark ends. The illusion here is that the bar is getting narrower as our eyes move from the left side of the bar to the right side. They are actually true rectangles, but our minds are playing a trick on us. In this case, the gray border around the legend appears as a border on the left side, but on the right side, the border blends into the darker color of the legend which makes it look like it disappears.

This is a very subtle and minor example, but this is one of the reasons that data visualization experts avoid gradient effects and pay such close attention to the use of color. In this particular case, the sequential color scheme is used on a chart or map and this is the legend, so the gradient color isn’t used for an effect, but rather encoding a range of data, going from light for the low value to dark for the high value.

There are a few solutions to solving this particular issue. One easy method is to apply a darker border to the legend. In the example below, the black border moves the blending effect further to the right side, therefore reducing the effect of the illusion.

This helps quite a bit, but it doesn’t solve it completely. In the original example which is the default in Tableau, the light gray border disappears in the middle of the bar and blends into the bar color. Using a black border moves that blending to the right side of the legend.

In the next example, there is a dark border around a light border, and the visual perception problem is solved. Notice in this example there appears to be white space on the right side of the legend that blends in on the left side. The double border helps visualize an equal size legend as the eye moves from left to right.

Below is a visual comparison of the 3 options side by side:

Both of these examples were taken from Tableau Public Visualizations, and unfortunately we have limited options in Tableau for solving this particular problem. There are no border options for the bar in a legend, let alone the control of a double border. In the examples below we can help resolve the visual perception problem by using a pseudo border. This option uses another principle of visual perception called the Gestalt Principle. Our minds will quickly draw conclusions from incomplete information, in this case forming a rectangle. By adding a partial border our minds will perceive enough of a border around the legend and provide a baseline running parallel to the bottom of the legend which minimizes the visual perception problem that occurs in the default legend.

This partial border is done by:

   1.) underlining the legend title
   2.) adding a vertical object with a border
   3.) setting the float order to back

Note: you will not be able to use a static image (the last option) if the visualization is interactive and the chart or map is dynamic causing the values to update. Also, even if the visualization is not interactive, this could cause a problem if the underlying data ever changes and the visualization is refreshed.

The legend examples above involve a very small object, but this issue also applies to other aspects of data visualization. Examine the bar chart below. In addition to the problems outlined above, notice the heavy emphasis given to the left side of the bars while the right sides disappear into the white background making it very difficult to determine the length of the bars and make quick comparisons.

Yes, we could also solve some of these issues by adding a border around the bars, but in this example, the gradient color scheme is adding no value. In the legend, we needed the sequential color scheme to differentiate between low and high, but that isn’t necessary on this bar chart. Also, adding a border still won’t help the heavy emphasis that is placed visually on the left side of the bars. In this case, as with most charts like this, using a standard fill without gradient is best.

I hope you find these examples helpful in outlining why visual perception is so important in the field of data visualization. If you would like to learn more about visual perception, I highly recommend the book Basic Vision: An Introduction to Visual Perception by Robert Snowden, Peter Thompson and Tom Troscianko.

As always, if you have any questions feel free to email me at Jeff@DataPlusScience.com

Jeffrey A. Shaffer
Follow on Twitter @HighVizAbility

Edited by Breanne LaCamera 11/9/2014 and posted 11/13/2014