This entry is part of the Chart Index, the reference library for the Chart Design Field Guide.

The treemap is Ben Shneiderman's 1991 answer to a hard problem: how do you show a hierarchical part-to-whole with hundreds of items? A pie cannot do it; nor can a bar chart. Shneiderman's solution was to recursively partition a rectangle proportional to its children's values, then recurse into each child. The result is a space-filling display where every leaf is a rectangle, every rectangle's area is its value, and the hierarchy is implicit in the nesting.

It is a chart designed for zoom-in: at a glance, the eye picks out the largest regions; on inspection, it traces the structure within each. The form trades precise comparison (area perception is poor) for density (you can show a thousand leaves in one panel without scrolling).

What it is

A treemap maps a hierarchical categorical structure to nested rectangles and a quantitative variable to rectangle area. The outer rectangle holds the total; it is partitioned into rectangles for each first-level category, with each child's area proportional to its value. Each first-level rectangle is recursively partitioned for its children, and so on. The layout algorithm (squarified, slice-and-dice, strip) determines how the partitions are arranged.

Cloud spend by service familyFY 2025 · AUD m · 4 families · 24 services

Four service families (Compute, Storage, Data, Identity), with each family decomposed into its constituent services. The largest blocks dominate the eye; smaller services nest within their family. The hierarchy is read by looking at the containers; the magnitude is read by area.

When to use it

Treemaps are the right choice when:

  • You have a hierarchical structure with part-to-whole semantics — categories that sum to a total.
  • You have many leaves — too many for a bar chart, too structured for a simple list.
  • The reader's question is "where does the spending / time / volume go?" rather than precise comparison.
  • The first-level groups are the dominant story; sub-level detail is secondary.
  • You can colour-encode a second dimension — change since last period, performance rating — without overloading the form.

When not to use it

  • Precise comparison. Area is one of the least accurate perceptual channels. For comparing values, a bar chart is better.
  • Non-hierarchical data. Without a hierarchy, a treemap is just a Voronoi of rectangles. Use a bar chart or waffle.
  • Very uneven values. If the largest leaf is 1,000× the smallest, the smallest leaves become unreadably thin strips. Filter or aggregate the tail.
  • Negative values. Area cannot encode negative numbers. For revenue mixed with losses, use a waterfall or grouped bar.

Design principles

Use the squarified layout

Squarified treemaps produce rectangles close to square, which the eye reads more accurately than long thin strips. Unless you need to preserve a specific order (e.g., time within a hierarchy), use squarified.

Show the hierarchy clearly

Each level of the hierarchy needs visual distinction. The outer group label sits on the outside or top of its block; the inner labels sit inside their cells. Padding between groups (4–8 pixels) helps the eye separate levels.

Quiet the palette

Treemaps are dense. Saturated colours produce a quilt that competes with itself. Use a desaturated categorical palette for the top level, with sub-levels deriving their colour from their parent. Or use a single hue family throughout.

Treemap layouts — slice-and-dice vs. squarified
SLICE-AND-DICE — THIN STRIPSABCDEFGHSQUARIFIED — BALANCED RECTANGLESABCDEFGH
Both show the same data. Squarified produces rectangles close to 1:1 aspect ratio; slice-and-dice produces strips. Squarified is more readable.

Label only the readable rectangles

Tiny rectangles cannot host labels. Set a minimum readable area (perhaps 40 × 24 pixels) and label only cells above that. For smaller cells, use tooltips on hover or aggregate into an Other bucket.

Use colour for a second variable

The hierarchy gives you grouping; area gives you value. A third dimension — change since last period, performance rating, ownership — can be encoded as cell colour using a diverging or sequential scale. Two encodings (area, colour) is the maximum without overloading.

Avoid 3D and shadows

Drop shadows, 3D perspective, and beveled edges turn the treemap into a quilt of decorative tiles. The form's beauty is its flatness and density. Resist the temptation.

Show the total

The total — the area of the whole rectangle — is the implicit top of the hierarchy. State it in the subtitle so the reader can convert the visible rectangles back to absolute numbers.

Anatomy

The Composition of a Treemap
EC220mLambda14mK8s11mCOMPUTES318mEBS10mSTORAGEAthena8mRedshift10mDATAIAM9mIDENTITYCELL AREA = VALUEPARENT GROUP LABEL
An anatomical guide

A treemap's anatomy is recursive: outer rectangle, child rectangles, child-of-child rectangles. The visual structure carries the hierarchy; the cell areas carry the values.

  • Sunburst — hierarchical part-to-whole as concentric rings. Different shape, same problem.
  • Voronoi treemap — non-rectangular partitions for a more organic look.
  • Sankey diagram — flows between hierarchical levels rather than nested partitions.
  • Marimekko / Mosaic — width-encoded variant for cross-tabulations.
  • Bar chart — for the same data when precise comparison matters more than density.

Reading list

  • Shneiderman, B. (1992). Tree Visualization with Tree-Maps: A 2-D Space-Filling Approach. The original paper.
  • Bruls, M., Huijing, K. & Wijk, J. (1999). Squarified Treemaps. The squarified layout algorithm.
  • Heer, J., Bostock, M. & Ogievetsky, V. (2010). A Tour Through the Visualization Zoo. Treemap variants and best practices.