Saturday, October 4, 2014

Color your way to visual finesse

The color palette we use the most in Tableau is either discrete or gradient. Discrete colors are applied to categorical data or dimensions. Gradient colors are applied to numerical data or measures.

Here we try to go beyond the dichotomy of discrete and gradient. Rather our approach is a combination of both discrete and gradient color palette. We will use color to categorize numerical data and apply gradient color to a subset of the data.

Below I will show a few special ways to color your data, simply using the color editor in Tableau. The purpose is to create big contrast between data and to accentuate the difference in the data of interest.

To create the maximum contrast, we always try to use the following:
-diverging color palette
-full color range
-setting center, start and end values.

The choice of Center, Start and End values must be judicious.

Example 1. Differentiate zero and positive numbers

At one time, I wanted to create a regular heat map of dynamic data, which are mostly positive integers. There are occasionally zeros that people need to be alerted about.

Then I select a red-green palette and set Center=1 Look at what I got:

So you see it's quite simple to create 2 categories of data using different colors: zero and positive numbers. And the latter is in gradient color.

Example 2. Differentiate numbers below and above a threshold

This is used when we care about the grades at one side of the threshold and get alerted when the values go to the other side. For example, we paint those numbers above threshold in red and those below the threshold in gradient green.

In the example below, we deal with an upper threshold = 75. We only care about those numbers between 0-74. Anything that is 75 and above is paint red.

Here we set Center=74.5 and End=75. Thus any number above 75 will be in full red. From 0 to 74, it will be in gradient green.

Note that the color is reversed in the editor: green for lower numbers and red for above 75.

Obviously, this approach also works for lower threshold.

Example 3: Make a bi-color map
In case where data is split into two categories: above threshold and below threshold, we need to apply only two colors to the data. No gradient color is needed. Say, for data <=15 it's red. For data >=16 it's green. This can be done by setting center=15.5, start=15 and end=16.

The above could be done using calculated field as well. But I believe using color editor is a simpler approach.

The workbook is available here for further exploration.
                                                                               


No comments:

Post a Comment