# Treemap

**Category:** charts  
**Short Description:** A hierarchical visualization using nested rectangles to show proportions.  
**Last Updated:** 2026-05-30T00:00:00Z

## Definition

Treemaps display hierarchical (tree-structured) data as a set of nested rectangles. Each branch of the tree is given a rectangle, which is then tiled with smaller rectangles representing sub-branches. The area of each rectangle is proportional to a specified dimension of the data (e.g., size, value), making it useful for visualizing part-to-whole relationships within a hierarchy.

## Examples

- E-commerce revenue breakdown by product category hierarchy, showing multiple levels of categorization

## FAQs

### What is a treemap?

A treemap displays hierarchical data as a set of nested rectangles, where each rectangle's area is proportional to its value and rectangles are grouped inside larger parent rectangles to show the hierarchy. For example, total revenue as the whole, divided into category blocks, each subdivided into product blocks. It packs part-to-whole composition and many categories into a dense, space-efficient layout.

### When should I use a treemap?

Use one when you have hierarchical or part-to-whole data with many categories that would overwhelm a pie or bar chart — budget broken down by department and team, traffic by channel and source, disk usage by folder. Treemaps excel at fitting hundreds of values into a small space and revealing which blocks dominate. Avoid them when precise comparison matters, since area is judged less accurately than length.

### Treemap vs pie chart — which is better for composition?

Both show part-to-whole, but a treemap handles far more categories and supports hierarchy, while a pie chart is limited to a few flat slices. Treemaps also use space more efficiently. Neither is great for precise comparison (area and angle both read imprecisely), but for many categories or nested data a treemap is the clear winner; for a simple 2–5 category split a pie or bar chart is fine.

### How do I keep a treemap readable?

Limit hierarchy depth (one or two levels is usually enough), label the larger rectangles directly and use tooltips for small ones, and use color deliberately — either to encode a second variable (e.g. growth rate) or to distinguish top-level groups, not just decoration. Sort rectangles by size so the biggest sit in a consistent corner, and group tiny values into an 'Other' block.

### Can treemaps show a second variable with color?

Yes, and it's one of their strengths. Size encodes the primary value (e.g. revenue) while color encodes a second metric (e.g. profit margin or year-over-year growth, often on a diverging scale). This lets a single treemap answer 'which segments are big, and which big ones are also growing or shrinking'. Provide a clear color legend so the second dimension is interpretable.

## Related Terms

### Alternatives

- **[Network Graph](/resources/glossary/charts/network-graph)**: Shows relationships between entities using nodes and edges

### Similar Terms

- **[Pie Chart](/resources/glossary/charts/pie-chart)**: Shows part-to-whole for a single level, treemaps extend this to hierarchies
