Create Heatmaps that Show Trends or Density in Tableau
You can create maps in Tableau to reveal the patterns or relative concentrations that might otherwise be hidden due to an overlapping mark on a map. These types of maps are called heatmaps, or density map. Tableau creates a heatmap by grouping overlaying marks, and color-coding them based on the number of marks in the group.
Density maps help you identify locations withhow greater or fewer numbers of data points. Density maps are most effective when working with a data set containing many data points in a small geographic area.
To create a density map, your data source should:
- Latitude and Longitude coordinates or location names (if recognized by Tableau)
Tableau can recognize location names and create a density map using the point locations assigned to Tableau geocoding locations, but density maps are most effective when the location data is very precise, such as location coordinates in a limited space. Density marks work best where the specific locations change continuously and smoothly across space, rather than values constrained to discrete locations like borough or neighborhood.
|Columns shelf:||Longitude (continuous dimension, longitude geographic role assigned)|
|Rows shelf:||Latitude (continuous dimension, latitude geographic role assigned)|
|Detail:||One or more fields with many underlying data points|
You can choose “Density” from the mark type drop-down and Tableau will compute a density surface on your view. The density surface that appears recomputes as you zoom or filter data on the remaining marks. When using Pages or a small multiples view, the Density is computed across the full domain of the data for comparative analysis.
To follow along with this example, download the Create Heatmaps in Tableau Example Workbook (click Download in the upper right hand corner), and open it in Tableau Desktop.
Open a new worksheet. In this data source, these fields are named Pickup Latitude and Pickup Longitude. Ensure that the Pickup Latitude geographic role is assigned to your latitude field, an the Pickup Longitude geographic role is assigned to your longitude field.
For more information, see Assign a geographic role to a field.
In the Data pane, double-click Pickup Latitude and Pickup Longitude to bring them to the view.
The Latitude and Longitude fields are added to the Columns and Rows shelves, and a map view with one data point is created.
Now, let’s add distinct marks to the view. Select ID and place it on the Details mark. Because each pickup has its own ID, this breaks up the mark and distinguishes one pickup from another on our map.
There will be a warning letting you know that the field added may contain more than the recommended maximum of 1000. Select Add all members.
The map view updates to show marks for every pickup location in your data source. Since every location is within Manhattan, the map will zoom to focus on Manhattan in New York City.
Note: You might need to filter some data points from your view to create the level of zoom desired.
On the Marks card, change the mark type to density by selecting the drop-down menu to the right of Automatic and select Density.
Your basic density map is created. You can see that midtown is the most popular area for taxi pickups in October, although you can adjust the focus further by using the zoom tool. Density will recompute as you zoom in or out.
Color: Adjusting the colors of your density map by selecting Color from the Marks card. Choose from ten density color palettes, or any of the existing color palettes.
Note: If your data source contains them, negative values will also appear when a measure field is added to Color. Use a diverging color palette to make a clear distinction between positive and negative values.
Intensity: In the Color menu, use the Intensity slider to increase or decrease the vividness of your map. For example, increasing density lowers the "max heat" spots in your data, so that more appear.
|Low Intensity (50%)||High Intensity (80%)|
Size: You can use the Size shelf to adjust the size of the density marks. Clicking on the Size mark will show the size slider. Adjusting the slider will apply a size increase or decrease to the size of the marks group that makes your heatmap.
Underlying marks): You can select an individual data point from anywhere in your density map. These marks have size (10 pixels) and color (blue) applied by default. Size and color are not adjustable for underlying marks.
Zoom: Selection, tooltips, labels, and hovering all work based on the marks in the zoom of the view. Density maps have no fixed or constant display and will always recompute as you zoom.