Charts & Visualizations

Treemap

A hierarchical visualization using nested rectangles to show proportions.

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

Chart Visualization

This example includes an interactive chart visualization with 25 data points.

Chart type: treemap

Usage

Best Used For

  • Showing hierarchical structures and their relative sizes
  • Comparing proportions within nested categories
  • Visualizing disk space usage or organizational structures
  • Displaying large amounts of hierarchical data compactly

Data Requirements

[Object]

Limitations

Important Considerations

  • Deep hierarchies can become difficult to read and label
  • Comparing areas of non-adjacent rectangles can be hard
  • Aspect ratios of rectangles can sometimes distort area perception
  • Not effective for showing evolution or changes over time

Best Used For

  • Showing hierarchical structures and their relative sizes
  • Comparing proportions within nested categories
  • Visualizing disk space usage or organizational structures
  • Displaying large amounts of hierarchical data compactly

Frequently asked questions

Common questions about Treemap, answered.

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

Network Graph

Related term

charts, alternative

Pie Chart

Related term

charts, similar