# Treemap Chart

Treemapping is a data visualization technique that is used to display hierarchical data using nested rectangles; the treemap chart is created based on this technique of data visualization.

The treemap chart is used for representing hierarchical data in a tree-like structure. Data, organized as branches and sub-branches, is represented using rectangles, the dimensions and plot colors of which are calculated w.r.t the quantitative variables associated with each rectangle—each rectangle represents two numerical values. You can drill down within the data to, theoretically, an unlimited number of levels. This makes the at-a-glance distinguishing between categories and data values easy.

A simple example Take a look at the chart sample shown below:

The treemap chart above shows the category-wise sales figures for popular motorbike models. Each rectangle showcases two quantitative variables: the average sales for a model—represented by the dimensions of the rectangle—and the percentage growth in the sales of a model compared to the previous year—represented by the color of the rectangle.

Below are a couple of deductions that you can easily make from the above chart:

- Although Harley-Davidson XG500 sold less no. of units than Honda NBC110 this year, the former’s growth in sales from last year is far better than the latter.
- The Honda NBC110 is the only Honda-manufactured motorbike to see a decent growth in its sales. That said, charting facilitates the desired analysis only when data is visualized on the right type of chart—if you’ve worked with data visualization extensively, you’d know that this varies not just basis your data, but also basis the kind of analysis you want to facilitate.

Read on to know the best situations in which you can use your treemap chart to utmost advantage.

## Ideal use cases for a treemap chart

Like every chart type and data visualization technique, the treemap charts works well only if it is used in situations that justify its use. Let’s take a look at what are the ideal use cases that warrant the use of a treemap chart:

**Your data needs to be studied w.r.t two quantitative values.**
Each rectangle (node) in the treemap chart showcases the values for two quantitative values. Like said above, the dimensions of the rectangles in the sample treemap chart (above) represent the units sold for a model in the current year and the color represents the growth in sales w.r.t the previous year sales.

**You have a very large amount of hierarchical data and a space constraint.**
Treemap charts are equipped to be able to plot more than tens of thousands of data points. There are other charts that can be used for plotting hierarchical data; some of the charts that may quickly come to mind are the multi-level pie chart and the drag-node chart. However, these charts present a space constraint as the number of data points increases beyond a certain limit. Additionally, the multi-level pie chart is circular while the treemap is linear; a linear chart is easier to read and understand than a circular one.

**You want a quick, high level summary of the similarities and anomalies within one category as well as between multiple categories.**
The dimensions and colors of the rectangles (nodes) in a treemap chart are configured based on the numerical values assigned to each node. This makes it easy to identify the trends and patterns between the nodes of all the categories plotted on the chart as well between the nodes of a single category. For example, Honda-manufactured bikes have done better in the Street category than in any other category.

**Your data can be organized at several levels.**
Treemap charts support the drill down feature; chart users can easily drill down to do a detailed study of data at several granular levels.

## More examples of a treemap chart

The treemap chart shown below showcases region-wise literacy rates and population based on the data collected for a period of one year. The size of each rectangle represents the population, the color represents the literacy rate.

## Limitations of a treemap chart

The treemap chart poses the following limitations:

- You cannot display data that varies in magnitude.
- Out of the two quantitative variables that a rectangle represents, the variable standing for the size of the rectangle cannot have a negative value.
- One of the values that a rectangle stands for is to be gauged from the area of the rectangle; this is a slight difficulty when compared to other charts where you can gauge values from the length of the data plot.
- The rectangles are automatically ordered by area within the parent node; the chart does not provide for any more sorting options.
- Treemaps having a large number of data points on a single level are unsuitable for print.

Treemap charts need a significant amount of effort when you are creating one. But once you’ve figured them out, there aren’t many charts that can pack as much a punch as these charts for showcasing hierarchical data.

This was a quick guide on the dos and don’ts of using treemap charts. You can see more sample implementations of this chart here.