Adding an Ordered Sequential Color Palette to Tableau Desktop: Example with Hex Map

In my previous blog, I made a hexbin map as part of a Workout Wednesday challenge. As part of the Workout Wednesday, Sean Miller (who created the challenge), asked those attempting the WoW to add in a custom color palette. The color range in the image below is not native to Tableau, meaning it doesn’t come with Tableau as a default color palette.

The following code was provided within the requirements:

<color-palette name=”OrRd-5″ type=”ordered-sequential” >
<color>#FEF0D9</color>
<color>#FDCC8A</color>
<color>#FC8D59</color>
<color>#E34A33</color>
<color>#B300</color>
</color-palette>

In order to add a palette to Tableau, I had to access the Preferences.tps file located in the Tableau Repository folder that was created when we downloaded and installed Tableau Desktop. To clarify, adding custom palettes is currently limited to only Tableau Desktop. The Tableau Repository has the basic support files and folder along with the sample data sources. This is what it looks like on my Windows laptop:

Notice the Preferences.tps file on the bottom. This is what we’ll need to open and edit to add the custom color palette. Usually, to open the file, I just double click, but doing so with this file will prompt Tableau Desktop to launch and an error message will pop up. To avoid this, right click on the file and select Notepad (for Windows):

Between the <workbook> and </workbook> tags, insert the tags <preferences> and </preferences>:

To add the custom color palette from the challenge, copy and paste the code between the two preferences tags:

Save the Preferences.tps file. Save and close the Tableau workbook. Restart Tableau Desktop and open the workbook again.

Click on Color in the Marks card and then Edit Colors. Select the Palette that was just created:

After clicking apply, however, we can see that the colors don’t quite line up with what the mp in the challenge looks like and this is because we also have to reverse the colors:

Hit apply and voila!

For details on how to create the hex map, check out my blog from last week here!

Thanks for following along and hope this helps! 'Til next time!




Author:
Jessica Kwan
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2024 The Information Lab