<< Back

How to create a stepped colour scheme with a colour alert in Tableau (using a continuous colour palette)

Colours, colours, colours in Tableau. I had a client who wanted something very specific. He wanted a stepped colour scale, but with a visual alert, colour or otherwise, when the value went above a certain threshold. He gave an example of a box going red (on an otherwise white to blue colour scale). I thought that was something I could work with.

Let’s say, for example, I wanted to look at the number of different product containers used by month over the years 2010 – 2013. Let’s say anything over 5 different product levels is critical and needs to be highlighted using a loud colour (screaming red). Anything up to 5 could be coloured from white to deepening shades of blue.

First, I made sure my variable was continuous.

Then I dragged it onto colour.

Continuous field on colour
Continuous field on colour

Next, I chose a diverging colour palette using Tableau’s colour options and made a note of 3 hex codes: One each for the two ends of the spectrum of colour that I wanted to diverge between (in this case white and dark blue), and the third one the colour that I wanted as my “alert” colour (red).

Following that, I opened up my preferences.tps file (which I found in the “My Tableau Repository” folder) in a text editor, found the most suitably-named colour palette to use as a template (“ordered diverging” in this case) and created a new colour palette with these three hexcodes. I chose a name for the new colour palette that matched the name of the project.

New colour for my preferences.tps file
New colour palette for my preferences.tps file

Going back into Tableau, I selected my newly-created colour palette to use as the colour range for my variable. (Closing and re-opening Tableau might be necessary at this stage.)

I made sure the “Stepped Colour” and “Use Full Colour Range” boxes were ticked and opened up the Advanced options by clicking on the “Advanced >>” button.

From there, it was a matter of adjusting the start, end, and centre points, as well as the number of steps to get exactly the right effect I had in mind.

New colour palette settings
New colour palette settings

Finally, I dragged the same continuous field onto labels and changed my mark type to Square to create a heatmap/highlight chart effect and also so that I could check that the values and colours were matching my expectations. (In this case, white to blue for values between 1 and 5, and red for values above 5).

The Final Result
The Final Result

 

by Rachel Phang

(also posted on my personal blog: https://vizteriousgirl.wordpress.com/)

Rachel Phang

London, UK

3 thoughts on “How to create a stepped colour scheme with a colour alert in Tableau (using a continuous colour palette)

  1. Thanks for sharing, white, amber, red could have been more appealing to the eyes. Any particular reason why your client wanted blue and red.

Leave a Reply

Your email address will not be published. Required fields are marked *