---
schema_version: "1"
id: 21979dac6a2363fec9cc0f34c4dc6afc5dce6d76f9417f946cd292b6df17a7b4
title: Build a Treemap
collection: tableau
version: next
locale: en-gb
portal_url: https://docs.salesforce.com/tableau/next/en-gb/pro/desktop/buildexamples_treemap.md
canonical_url: https://help.tableau.com/v0.0/pro/desktop/en-gb/buildexamples_treemap.htm
source_site: help.tableau.com
content_type: documentation
content_hash: 87458ff451eb12b0c612d9ee7a6af7b889f0dbf0d1a4f5ee8b0b99ec0bf12610
description: Build a treemap to display data as nested rectangles sized and colored by measures.
---
[Skip to main content](#main-content)

# Build a Treemap

Use treemaps to display data in nested rectangles. You use dimensions to define the structure of the treemap, and measures to define the size or colour of the individual rectangles. Treemaps are a relatively simple data visualisation that can provide insight in a visually attractive format.

The basic building blocks for a treemap are as follows:

- **Mark type**: Automatic or Square
- **Colour**: Dimension or Measure
- **Size**: Measure
- **Label** or Detail: Dimension(s)

To create a treemap that shows aggregated sales totals across a range of product categories, follow the steps below.

1. Connect to the Sample - Superstore data source (if necessary, you can download it from the [Tableau Public sample data page](https://public.tableau.com/app/learn/sample-data)).
2. Drag the Sub-Category dimension to Columns.
    
    A horizontal axis appears, which shows product categories.
3. Drag the Sales measure to Rows.
    
    Tableau aggregates the measure as a sum and creates a vertical axis, making a bar chart – the default chart type when there is a dimension on the Columns shelf and a measure on the Rows shelf.
4. Click Show Me on the toolbar, then select the treemap chart type.
    
    ![A chart selection tool that highlights the tree map chart type.](/tableau/next/en-gb/pro/desktop/en-gb/Img/tree_1.png)
    
    Tableau displays the following treemap:
    
    ![A treemap illustrates sales across various office supplies subcategories, highlighting phones and chairs as top sellers.](/tableau/next/en-gb/pro/desktop/en-gb/Img/tree_2_10.0.png)
    
    In this treemap, both the size of the rectangles and their colour are determined by the value of Sales – the greater the sum of sales for each category, the darker and larger its box.
5. Drag the Ship Mode dimension to Colour on the Marks card. In the resulting view, Ship Mode determines the colour of the rectangles – and sorts them into four separate areas accordingly. Sales determines the size of the rectangles:
    
    ![A treemap chart that displays sales across various product sub-categories.](/tableau/next/en-gb/pro/desktop/en-gb/Img/tree_3_10.0.png)
6. Try another option to modify the treemap: click the **Undo** button to remove Ship Mode from view.
7. Drag the Profit measure to Colour on the Marks card. Now Profit determines the colour of the rectangles, and Sales determines their size:
    
    ![A treemap chart that reveals product sub-categories by their total profit.](/tableau/next/en-gb/pro/desktop/en-gb/Img/tree_4_10.0.png)

With treemaps, Size and Colour are the crucial elements. You can place measures on Size and Colour, but placing a measure anywhere else has no effect. Treemaps can accommodate any number of dimensions, including one or even two on Colour. But beyond that, adding dimensions only breaks the map into an ever greater number of smaller rectangles. For information on how to place two dimensions on Colour in a treemap, see [Example – Multiple Fields on Colour](https://help.tableau.com/v0.0/pro/desktop/en-gb/viewparts_marks_markproperties_color_ex1.htm).