Coloring the Ends of a Bar Chart in Tableau

The Theories We Learn

As much as I’m a huge fan of color, I’m also an advocate for reducing it whenever possible. You may have heard of Pre-attentive Processes and Gestalt Principles. Both are cognitive responses to the visual world that we make unconsciously.

As a visual designer and former marriage and family therapist, I know Gestalt well. If you are reading this, you likely have heard of Gestalt principles—those theories we learn in data visualization about proximity, similarity, symmetry, etc.

However, as a therapist first, I learned about Gestalt as it related to a theory of therapy that focused on helping patients focus on the here and now – the present. Without going into a psychotherapy lesson, the concepts are the similar to those well known “principles”. These are ways in which our brain groups and organizes our world to help us be more functional and effective.

Similarly, Pre-attentive Processes are ways in which our visual brain “pays attention” to certain stimuli while ignoring others. It’s the whole “Did you see the gorilla walking through the basketball game” study. (If you don’t know what I’m talking about, you must catch up!)

Okay, why all the preamble? Well, there is a struggle in data visualization between the need and desire to show data and the need to highlight that data with color while constraining attention to only certain data points. This tension often contributes to confusion among dashboard developers, who become challenged with just “how much” color to use and when.

Using Color Sparingly

Historically, if a stakeholder asked me to create a bar chart that required some level of color encoding, I would agree without much interpersonal or design tension. I might create something like the image below. They did ask for sales by subcategory with category on color for reference, right?

Bar chart in Tableau with multiple colors on bars.

But why comply? Is all this color needed? Really needed?

I don’t think so, especially in bar charts, which inherently take up space. They have a 2-dimensional area that they take up. Their height and width aid in our quick interpretation but also take up visual space and ink, for that matter.

So what is the alternative, you ask? Ah… Just a little less color but with the same data encoding and impact.

Coloring Only the Ends of a Bar Chart in Tableau

To reduce the visual intensity, I like to dial down the saturation of my bar charts. While you can easily adjust the opacity of the color in Tableau simply by adjusting the slider in the color mark card, I prefer reducing everything to gray except the essential pieces.

Bar chart in Tableau using opacity on color.

What if we only highlighted the ends of the bar to show the category as contextual information? The main insight—that of Sales—would be the first thing observed from the length of the bars, and the second insight would be which category that subcategory belongs to.

Bar chart in Tableau showing gray bars with color on the ends.

Even better, we can label the ends and remove the axis using Tableau’s “match mark color” to label the bars with the corresponding bar end color.

In my opinion, this view is so much more pleasing that the fully colored bars. So let me show you quickly how to create this bar chart with colored ends only.

Coloring the Ends of Bars Using Gantt Marks

The steps are relatively simple, but be aware that this technique requires a dual axis bar chart and if you aren’t able to use a dual axis (perhaps you already have another need that requires it, or you are using measure values/names) then this approach won’t work. In the event a dual axis is a go – then let’s go!

Step 1: Create your bar chart

  • Place a dimension on rows and a measure on columns
  • Drag that same measure to columns again or select the pill and Cmd+Drag / Ctrl+Drag to the right to duplicate it
  • Right click / select the drop down on the measure pill and select “dual axis”
  • Right click / Cmd+click the axis and select “synchronize axes”.

Step 2: Change Second Mark to Gantt

  • Select the second mark type and change it to a Gantt bar
  • Add the dimension to color on the Gantt mark
  • Remove the tooltip from the Gantt mark and format it on the bar mark
  • Add the measure label to the Gantt mark if desired
Changing the mark to a Gantt in Tableau

Final Bar Chart with Gantt End Lines

In the end, we have a less intense visual that still has color while not distracting from the actual measure of importance in the view.

Bar chart with colored line ends using a dual axis and Gantt mark type

Want the workbook?

If you want to check out this tip plus 4 others, you can find all these amazing yet simple Tableau design hacks in the workbook on my Public profile and please listen to the presentation I gave at the Newbies Tableau User Group (TUG) (I’m start around minute 42). Let me know if you have questions!

Cheers!
Lindsay

Leave a comment