TapCub is live — analytics, insights and live chat, free on one platform
Analytics

Treemap Visualization: When It Beats a Bar Chart and How to Read It

A decision rule for treemaps, one month of traffic drawn as treemap areas and a sorted bar list, what perception experiments found and the squarified layout in four steps.

Oliver Reed Published Dec 3, 2026 11 min read Analytics
Sample data: seven channels that a treemap would draw as areas from 160,000 down to 6,000 square pixels in an 800 × 500 box. As aligned bars the ranking reads at once.Sample data

Treemap visualization shows a hierarchy as nested rectangles whose areas match values, so you see each group's share and what is inside it. Use it for part-to-whole across a hierarchy with many categories. To rank or compare a modest number of values, a sorted bar chart is easier to read accurately.

What you will learn

  • Use a treemap only for additive, non-negative values with a hierarchy you want to see
  • People judge area less accurately than position; in experiments bars beat treemaps for leaf values at lower item counts
  • Squarified layouts avoid slivers: in the sample the worst rectangle is 2.4 to 1 instead of about 42 to 1

What is a treemap?

A treemap shows a hierarchy as nested rectangles. Each rectangle's area is proportional to a value, and a parent rectangle contains its children, so you see the share of each group and what makes it up in one picture. A website example: a rectangle per channel, subdivided into a rectangle per source.

The idea came to Ben Shneiderman in 1990, when an 80 MB disk shared by 14 users in his lab was filling up and it was hard to see where the space went. The University of Maryland's history of treemaps dates the first technical report to March 1991 and the journal paper to January 1992.

The rest of this guide makes one argument: a treemap earns its place when you need part-to-whole across a hierarchy with many categories; when the job is comparing a modest number of values, a sorted bar chart reads better. Perception research says why, and one set of traffic data drawn both ways shows it.

When is a treemap the right chart?

Answer four questions in order:

QuestionIf yesIf no
Do the values add up to a meaningful total?ContinueUse bars or a table; area implies parts of a whole
Are all values zero or positive?ContinueUse a diverging bar chart; a rectangle cannot have negative area
Is there a hierarchy you want to see (group, then item)?ContinueA sorted bar chart is simpler
Are there too many items for a readable list, or do group totals matter most?A treemap fitsUse a sorted bar chart, grouped by parent

Typical good cases are storage by folder, spend by department and line item, catalog revenue by category and product, or traffic by channel, source and campaign when there are hundreds of campaigns. Weak cases are five categories, growth rates, anything that changes sign and any chart whose point is a trend over time.

Your situationChart to use
Five to a few dozen items to rankSorted bar chart
Two levels, group totals matterTreemap, or two linked bar charts
Hundreds to thousands of items, hunting the big onesTreemap
Values that can be negativeDiverging bar chart
Mix across several periods100% stacked bars
Two measures per itemScatter plot

When two charts both fit, pick the one that makes the most frequent question readable without labels.

The same traffic data as a treemap and a sorted bar

Sample data: one month, 40,000 sessions, 7 channels and 21 sources. In a treemap drawn in an 800 × 500 pixel box, each channel gets an area equal to its share of 400,000 square pixels.

ChannelSessionsShareSources insideArea in an 800 × 500 box
Organic search16,00040%4160,000 px²
Direct8,40021%184,000 px²
Referral5,20013%552,000 px²
Social4,60011.5%446,000 px²
Email3,2008%332,000 px²
Paid2,0005%220,000 px²
AI assistants6001.5%26,000 px²

Now the same data as a bar list of sources, sorted, top eight shown:

RankSource (channel)SessionsShareCumulative
1Search engine A (organic)13,20033.0%33.0%
2Direct8,40021.0%54.0%
3Newsletter (email)2,1005.3%59.3%
4Partner blog (referral)1,9004.8%64.0%
5Social network A (social)1,8004.5%68.5%
6Search engine B (organic)1,6004.0%72.5%
7News site (referral)1,3003.3%75.8%
8Social network B / Search ads (tie)1,200 each3.0% each81.8%

In the treemap you see at a glance that organic search is the largest block, that one engine fills most of it, and that referral is made of several mid-sized sources. In the bar list you see the ranking and the gaps. Try one question on each: is the partner blog bigger than social network A? The difference is 1,900 against 1,800, about 5% of the larger value. On two aligned bars that is a visible step. In a treemap the two rectangles sit in different parent boxes with different shapes, and most readers will need the labels.

The smallest source, assistant B with 200 sessions, gets 0.5% of the box: 2,000 px², a square about 45 pixels wide. On a 320 × 200 pixel phone chart it gets 320 px², about 18 pixels square, with no room for a name.

app.tapcub.com

Sample month by channel

sessions, 40,000 total
Organic search16,000
Direct8,400
Referral5,200
Social4,600
Email3,200
Paid2,000
AI assistants600
Sample data
Sample data: seven channels that a treemap would draw as areas from 160,000 down to 6,000 square pixels in an 800 × 500 box. As aligned bars the ranking reads at once.

Which chart wins for which task?

TaskBetter choiceWhy
Spot the largest one or two itemsEitherBig differences survive any encoding
Rank items or compare two close valuesSorted bar chartPosition and length on a shared baseline are judged more accurately than area
See how groups make up the totalTreemapParts and parents are visible together
Compare one group total with anotherTreemap, or bars of group totalsIn a treemap the total is already drawn; with item bars the reader must add
Read exact valuesTableNo chart beats a number
See change over timeLine or stacked areaTreemap rectangles move when values change
Scan thousands of items for the big onesTreemapMany small marks still fit on screen

For other question types, website traffic graphs maps common questions to chart types, and how to create a bar graph covers axis rules.

What does perception research say about area?

Two studies are worth knowing.

Jeffrey Heer and Michael Bostock replicated Cleveland and McGill's classic experiments with online participants and extended them to areas. Position judgments significantly outperformed length judgments, and area judgments did worse than angle judgments, with both significantly worse than position. Rectangle areas were judged about as accurately as circle areas. A surprise was that comparing two squares produced the worst accuracy among the aspect ratio combinations tested.

Nicholas Kong, Jeffrey Heer and Maneesh Agrawala compared treemaps with hierarchical bar charts as the number of items grew. When comparing two leaf items, bar charts were more accurate at lower densities; treemaps matched them past about 4,096 leaves and were faster there. When comparisons involved parent nodes, treemaps were more accurate. Their guidance, in plain words: with only a few hundred elements, bars are more effective for leaf values; with thousands, treemaps are. The stimuli were 600 × 400 pixel images, so treat the thresholds as tied to that size.

For a web report with 21 sources, that points clearly to bars for comparing sources. The treemap's case here rests on showing the channel structure.

How is a squarified treemap laid out?

The first treemaps used slice-and-dice: split the box into strips, switching direction at each level. Applied to our seven channels in an 8 × 5 box (one unit of area is 1,000 sessions), the AI assistants strip would be 0.12 wide and 5 tall, about 42 times longer than wide. The squarified algorithm by Bruls, Huizing and van Wijk avoids this in four moves:

  1. Sort the values from largest to smallest and work along the shorter side of the free space.
  2. Add the next rectangle to the current row if the worst aspect ratio in the row gets better. Organic search alone, 3.2 × 5, has a ratio of 1.56.
  3. If adding would make it worse, freeze the row. Putting Direct under Organic search would push the worst ratio to 2.84, so Organic search is fixed and Direct starts a new row in the remaining 4.8 × 5 space. Direct alone scores 2.74; adding Referral improves it to 1.54; adding Social would worsen it to 3.13.
  4. Repeat in the leftover space until all items are placed. In this sample the other rows are Social alone, Email alone, Paid alone and AI assistants in the last 1.2 × 0.5 corner.

The worst rectangle ends at 2.4, against about 42 with slice-and-dice. The cost, noted in the Maryland history, is that squarified layouts lose the original order and can shift noticeably when values change.

How do you read a treemap without being misled?

CheckWhat to do
What does area encode?Read the title; area must be one additive value
What does color encode?Often a second measure, such as conversion rate; check the legend, and do not read color as size
Are the small items grouped?An "Other" box hides detail; ask what it contains
Is depth readable?More than two levels at once usually needs click-to-zoom
Two periods side by side?Positions may move, so compare labels and numbers, not places
Do the parts sum to the total shown?Add them; missing or unassigned traffic should have its own box

One more rule for publishing: print the value in each labelled box and offer the underlying table, so readers who cannot judge area, including screen reader users, still get the numbers.

What can you use instead?

  • Sorted bar chart grouped by parent: for up to a few dozen items; the default for web reports.
  • Two bar charts: channel totals on top, sources of the selected channel below; exact and still hierarchical.
  • 100% stacked bars: to compare the channel mix of several periods or segments.
  • Scatter plot: when you care about two measures at once, such as volume and conversion; see scatter plots.
  • Table with a small inline bar: for audits where each number matters.

For the wider vocabulary of encodings, see data visualization.

How to get this data from TapCub

TapCub does not draw treemaps. It gives you the grouped numbers, and for the 21-source case above its sorted tables are the better view anyway.

TapCub Sources report channel table with visitors, sessions, pageviews, bounce rate and average time, plus an export menu
Demo data: a sorted channel table answers ranking questions directly and can be exported.
  1. Open Web analytics › Sources. The Channel groups tab shows sessions, share, visitors, engaged rate, bounce rate and conversion rate per channel type; Referrers and UTM give the level below.
  2. Answer the ranking question there. On Channel groups, sort by sessions, read the share column, then the conversion rate next to it to see whether a big channel is also a good one.
  3. See the mix over time. Channel mix over time shows counts or shares, which a treemap cannot do.
  4. Export if you need a treemap. Table export offers CSV and XLSX; keep a column for channel, one for source and one for sessions, and draw it in your charting tool. Check that exported rows add up to the total before you publish.

FAQ

What is a treemap used for?

Showing how a total splits across a hierarchy, such as storage by folder or traffic by channel and source. Each rectangle's area stands for a value, and nesting shows the grouping. It is most useful when there are many items and group totals matter more than precise comparisons between two small ones.

Is a treemap better than a pie chart?

For many categories or two levels, usually yes, because rectangles pack and label more easily than thin slices. Both encode quantity in ways that are harder to judge than bar length. With a handful of categories, a sorted bar chart is clearer than either.

How many categories can a treemap show?

Technically thousands, which is where research found treemaps competitive with bar charts. Readability depends on size: a source with 0.5% of an 800 by 500 pixel chart gets a square about 45 pixels wide. Group the tail into "Other" and keep the detail in a table.

What does color mean in a treemap?

Whatever the legend says. It may mark the parent group, or encode a second measure such as growth or conversion rate. Use one meaning at a time, keep the scale readable for color-blind viewers and never let color be the only way to read an important value.

Can a treemap show negative values?

No, because area cannot be negative. For profit and loss, or change that can go either way, use a diverging bar chart. Some tools size rectangles by absolute value and color by sign, which readers easily misread, so label it clearly if you must.

Sources

Filed underAnalytics

Was this article helpful?

We use your answers to fix and expand this page.

Oliver Reed

Product Experience Specialist

Explores usability, user journeys, and feature adoption through practical examples of onboarding and everyday product use.

Get channel and source numbers you can chart

Source reports with sortable tables, channel mix over time and CSV or XLSX export.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics