Heat maps are a great way to compare categorical data using color. In Tableau, you create a heat map by placing one or more dimensions on the Columns shelf and one or more dimensions on the Rows shelf. You then select Square as the mark type and place a measure of interest on the Color shelf. You can enhance this basic heat map by size-encoding and/or shape-encoding the cells in the table.
The following exercise walks you through using a heat map to explore how profit varies across regions, product categories, and customer segments.
Connect to the Sample - Superstore - English (Extract) data source, which is included with Tableau Desktop.
Drag the Customer Segment dimension
Headers are created with labels derived from the dimension member names.
Drag the Region and Category dimensions to Rows, dropping Category to the right of Region.
Headers are created with labels derived from the dimension member names. You have now created a nested table of categorical data (the Category dimension is nested within the Region dimension).
Drag the Profit measure to Color on the Marks card.
The measure is automatically aggregated as a sum. The color legend reflects the continuous data range.
Optimize the view format:
From the Format menu, select Cell Size > Square Cell.
Increase the mark size by pressing Ctrl+Shift+B. Hold down Ctrl+Shift and continue to press B until the squares are large enough.
Make the columns wider by pressing Ctrl+Right arrow. Hold down Ctrl and continue pressing the Right arrow key until the headings for Category are displayed in full:
These cell formatting options are also available when you select Cell Size from the Format menu.
In this view, you can see data for only for the Central region. You must scroll down to see data for other regions. Or you can maximize the Tableau Desktop window.
In the Central region, office machines seem to be the most profitable category, and bookcases the least profitable.
- From the Format menu, select Cell Size > Square Cell.
Click Color on the Marks card to display configuration options. In the Border drop-down list and chose a medium gray color for cell borders, as in the following image:
Now it's easier to see the individual cells in the view:
To make the colors more distinct, hover over the top right corner of the SUM(Profit) color legend, and then click the downward triangle that appears. The following menu of options is displayed:
Click Edit Colors. In the Edit Colors dialog box, select Use Full Color Range:
When you select this option, Tableau assigns the starting number a full intensity and the ending number a full intensity. If the range is from -10 to 100, the color representing negative numbers changes in shade much more quickly than the color representing positive numbers. If you do not select Use Full Color Range, Tableau assigns the color intensity as if the range was from -100 to 100, so that the change in shade is the same on both sides of zero. (See Color for more on color options.) The effect is to make the color contrasts in your view much more distinct:
Drag the Sales measure to Size
on the Marks card to control the size of the boxes by the Sales
measure. This enables you to compare absolute sales numbers (by size of
the boxes) and profit (by color).
Initially, the marks are too small:
To adjust the size of the marks, click Size on the Marks card to display a size slider:
Drag the slider to the right until the boxes in the view are the optimal size. Now your view is complete:
Use the scroll bar along the right side of the
view to examine the data for different regions. Notice what's going on
in the International region.