Vega Treemap Hierarchy

A squarified treemap where every leaf rectangle's area is proportional to its value and parent groups stay visually adjacent — the canonical 'show me a hierarchy by size' chart. This is a low-level Vega spec because the layout requires hierarchical data via the `stratify` transfo

Template details

  • chart
  • treemap
  • hierarchy
  • vega

When to use this template

This visualization excels at revealing the relative size of individual items within a nested hierarchy, making it easy to identify dominant contributors at each level of aggregation. Analysts reach for it to understand how a total quantity is distributed across various categories and subcategories, quickly spotting large segments and their constituent parts.

  • Hierarchical data with clearly defined parent-child relationships.
  • A single quantitative measure for leaf nodes, determining area.
  • Multiple categorical dimensions defining the hierarchy levels.
  • Datasets where part-to-whole comparisons are crucial.
  • When relative proportions are more important than exact numerical values.
  • Large datasets with many leaf nodes where space efficiency is valued.

Browse all Koan templates