How to Create a Treemap Visualization in Reveal

Casey McGuigan / Tuesday, June 16, 2020

A Treemap is a data visualization that shows hierarchical data using nested nodes (rectangles) of varying size and color. While a Treemap is sometimes categorized as a "distribution" visualization, I see it mostly referred to as a "part-to-whole" visualization, showing categories (parts) of a data set that add up to a total (whole) value. Categories are shown in proportion to other categories based on their value percentage to the total value being analyzed.

Unlike the arguably most popular part-to-whole visualization, the Pie Chart, a Treemap is designed for drill-down scenarios. It shows the relative weight of data points at more than one level (represented as a rectangle) letting you continuously drill down deeper into the data set that is represented by smaller rectangles for more efficient analysis. At the same time, Treemaps are not designed to convey numerical quantities; the intent is to show relative ranking and relative differences in data-set values.

Here is an example of a typical Treemap, showing McDonald's stores by type.

Using a Treemap

Best Practices for Using a Treemap

Like any other data visualization, a Treemap should be used in specific scenarios. It does not solve the same visualization as, for example, a Bar Chart or a Line Chart. It is really meant for a more complex, richer data display.

When to use a Treemap

  • Drill-down hierarchical data (data organized as a tree, with branches and sub-branches)
  • Illustrate hierarchies of relative weight and comparative values between categories (branches) and subcategories (sub-branches)
  • Display large data sets that need a compact, space-efficient visualization
  • When you want to deliver at-a-glance, quick data analysis without precise values. The relative size of the rectangles help identify patterns and/or outliers very quickly
  • To make efficient use of space. Treemaps can legibly display thousands of items on the screen simultaneously

When not to use a Treemap

  • If you are telling a data story that requires precise values
  • If you have negative data values
  • If you have flat, non-hierarchical data (though it's still OK to use a Treemap with no drill-down, it may not be the best data visualization to use for your data story
  • If your data is similar in size - in other words - if the user will see rectangles of the same size - it is counter to the Treemap best practices listed above

Examples of Treemap Data

Treemaps are best used for larger data sets, with a highly varying quantitative value that need to be displayed in a compact, space efficient manner. Data scenarios for a Treemap can include:

  • Election results by County or the number of votes by Party by County
  • Product sales by Category, Sub-Category by Country
  • Market shares of products by Technology / Regions / etc
  • Product Category Exports by Country
  • Sales by Division by Product

Using the Treemap in Reveal

To get started with the Reveal Treemap, try these great resources:

Is there a visualization that you'd like which isn't in Reveal? Shoot me an email at casey@revrealbi.io and let me know!

Thanks!

Casey