What is a Treemap in Tableau?

Cody Schneider9 min read

A treemap is one of the most effective ways to visualize hierarchical data in a compact, intuitive format. Instead of deciphering endless rows in a spreadsheet, you can see the composition of your data at a single glance, displayed as a set of nested rectangles.

This article will explain what a treemap is, when it’s the right chart for your data, and how you can build a polished one from scratch using Tableau.

What is a Treemap Chart, Exactly?

Think of a treemap as a space-filling visualization that shows you part-to-whole relationships within your data. It gets its name from tree diagrams, but instead of using branches, it uses nested rectangles to represent the hierarchy. Each rectangle’s size and color communicate different aspects of the data, allowing you to quickly spot patterns and outliers.

Here are the key components of a treemap:

  • Rectangles: Each section in a treemap is a rectangle representing a specific category or sub-category in your dataset.
  • Size: The area of each rectangle is directly proportional to a specific numerical value. A larger rectangle means a greater value, making it instantly clear which categories are the biggest contributors.
  • Grouping (Nesting): Individual rectangles can be grouped together inside larger rectangles to show their relationship. This is the hierarchical part - you might have a large rectangle for "Technology" sales, which contains smaller, nested rectangles for "Phones," "Laptops," and "Accessories."
  • Color: Color can add another dimension to your analysis. You can use it to represent a second measure (e.g., a color gradient from light to dark to show profit margin) or to differentiate between categories in your top-level dimension.

Imagine you run an online store. A treemap could display your total sales broken down by product category. The "Apparel" rectangle would be larger than the "Home Goods" rectangle if it generated more revenue. Inside the "Apparel" rectangle, you could see smaller, nested blocks for "Shirts," "Pants," and "Shoes," each sized according to their individual sales figures. This gives you a clear visual hierarchy of your best-performing products in seconds.

When Should You Use a Treemap?

Treemaps are incredibly useful but aren’t the right fit for every situation. They excel at displaying large amounts of hierarchical data where you want to compare proportions between categories.

Optimal Use Cases for a Treemap:

  • Hierarchical Data: This is a treemap’s specialty. It's perfect for data in a parent-child structure, like product categories and sub-categories, sales territories broken down by region and then by country, or website traffic by source and medium.
  • Comparing Proportions: Treemaps make it easy to see the relative size of many parts that make up a whole. They are often a better alternative to pie charts, especially when you have more than a few categories to display.
  • Large Datasets: They can display thousands of items within a limited space, which would be impossible with a bar chart or pie chart. This makes them ideal for getting a high-level overview of complex data.
  • Identifying Key Contributors: The size-based formatting automatically draws your eye to the most significant segments of your data. You can instantly spot your most valuable customers, top-selling products, or highest-spending departments.

When Another Chart Type is a Better Choice:

  • Precise Comparisons: It's hard for the human eye to accurately compare the area of two rectangles, especially if they are similarly sized but have different shapes. If you need to make precise, side-by-side comparisons, a bar chart is always a better option.
  • Non-Hierarchical Data: If your data has no parent-child relationship, using a treemap can add unnecessary complexity. A simple bar or column chart will communicate the data more clearly.
  • Negative Values: Treemaps represent values through area (size), which can only be positive. If your dataset includes negative numbers (like losses), you cannot visualize them in a treemap.
  • Showing Change Over Time: While you can create treemaps for different time periods, a line chart is far more effective for illustrating trends and showing an evolution over time.

How to Build a Treemap in Tableau (Step-by-Step)

Let’s build a treemap using the "Sample - Superstore" dataset that comes included with Tableau. Our goal is to visualize sales performance by Category and Sub-Category to see which products are driving the most revenue.

Step 1: Connect to Your Data

First, open Tableau Desktop. In the "Connect" pane on the left, under "Saved Data Sources," select Sample - Superstore. Tableau will load the dataset, and you’ll see your different tables and fields in the Data pane on the left side of the screen once you navigate to a worksheet.

Step 2: Start Building the View

You can create a treemap in a few quick steps by dragging your fields to different cards in the Marks shelf. Let's start with getting our basic measures and dimensions into the view.

  1. From the "Tables" list in your Data pane, find the Sales measure and drag it onto the Size card in the Marks shelf.
  2. Next, find the Category dimension and drag it onto the Color card.

At this point, you might not see anything yet, which is normal. We still need to tell Tableau how to structure the rectangles.

Step 3: Add Labels to Define the Rectangles

Currently, Tableau knows what to size and color by, but it doesn't know what each rectangle should represent. Let's fix that.

  1. Find the Category dimension again and drag it onto the Label card in the Marks shelf.

Tableau should now display a basic treemap. You'll see several large rectangles representing your main product categories ("Technology," "Furniture," and "Office Supplies"). The size of each is based on total sales, and the color distinguishes them. But our hierarchy has another level - Sub-Category.

Step 4: Add the Nested Hierarchy

Now, let's break down these main categories into their underlying sub-categories to create the nested effect.

  1. Find the Sub-Category dimension in the Data pane.
  2. Drag Sub-Category and drop it also onto the Label card.

Immediately, your treemap will transform. The large category rectangles are now filled with smaller rectangles, each representing a sub-category. You can quickly see that "Phones" and "Chairs" are top performers within their respective categories, while smaller items like "Labels" and "Fasteners" take up very little space.

Tableau automatically updates the labels to show both the Category and Sub-Category, establishing a clear visual hierarchy.

Step 5: Refine the Treemap for More Insight

Our treemap is functional, but we can make it more insightful with a few tweaks.

Enhancing Color with a Second Measure

Instead of just using color to tell the categories apart, what if it told us about profitability? A large rectangle with low profit could be a major problem spot.

  1. Find the Profit measure in the Data pane.
  2. Drag Profit and drop it directly on top of the Color card, replacing Category.

Tableau will change the color scheme to a gradient (likely blue and orange). Now, not only can you see sales volume by size, but you can also quickly spot profitability by color. Hover over the legend to see what the colors mean - dark blue might indicate high profit, while orange indicates a loss. Suddenly, you might notice that the "Tables" sub-category, while generating a decent amount of sales volume, is actually losing money!

Optimizing Labels and Tooltips

Let's make sure the labels are as useful as possible. It would be helpful to see the exact sales figure for each sub-category directly on the chart.

  1. Drag the Sales measure onto the Label card. It will now display the Sub-Category name and its total sales.
  2. The labels might look a little crowded. You can click on the Label card, then the small button with three dots ("...") to open the label editor. Here, you can change the font, size, and layout to make everything more readable.
  3. Finally, customize the tooltip that appears when you hover over a rectangle. Click the Tooltip card and edit the text to include any other relevant information, like Profit Ratio or Quantity sold.

Tips for Designing Effective Treemaps

A poorly designed treemap can be more confusing than helpful. Follow these best practices to ensure your visualization is clear, compelling, and easy to interpret.

  • Limit Hierarchical Levels: While you can add many levels to a treemap, it's best to stick to two or three. Any more, and the rectangles become too small and cluttered, making the chart difficult to read.
  • Use Color Meaningfully: Don't just add color for decoration. Use it to encode data. A sequential color palette (e.g., light blue to dark blue) is great for showing the magnitude of a measure like profit or growth. A diverging palette (e.g., orange-to-blue) works well to show positive and negative values.
  • Structure Your Data Intuitively: Organize your hierarchy from the general to the specific. Always place the broadest category at the top level and drill down from there. This logical flow makes it easier for viewers to understand the relationships.
  • Don't Forget Labels and Tooltips: Ensure the most important categories are clearly labeled. For smaller, less significant blocks where labels add clutter, rely on tooltips to provide the necessary details upon hover.

Final Thoughts

A treemap is a powerful visualization choice in Tableau for exploring large hierarchical datasets and quickly identifying proportions and major contributors. By representing data as nested rectangles sized by one measure and colored by another, you can pack a tremendous amount of information into a single, intuitive chart.

Mastering tools like Tableau is a great way to uncover insights, but often the biggest bottleneck is the manual work of preparing data and building reports. At Graphed , we harness AI to remove that friction completely. You can connect your data sources in seconds and create entire real-time dashboards just by describing what you want to see - like “Show me my top-selling products by profit margin.” We empower your team to get immediate answers from your data, so you can spend less time building and more time acting on valuable insights.

Related Articles

How to Connect Facebook to Google Data Studio: The Complete Guide for 2026

Connecting Facebook Ads to Google Data Studio (now called Looker Studio) has become essential for digital marketers who want to create comprehensive, visually appealing reports that go beyond the basic analytics provided by Facebook's native Ads Manager. If you're struggling with fragmented reporting across multiple platforms or spending too much time manually exporting data, this guide will show you exactly how to streamline your Facebook advertising analytics.

Appsflyer vs Mixpanel​: Complete 2026 Comparison Guide

The difference between AppsFlyer and Mixpanel isn't just about features—it's about understanding two fundamentally different approaches to data that can make or break your growth strategy. One tracks how users find you, the other reveals what they do once they arrive. Most companies need insights from both worlds, but knowing where to start can save you months of implementation headaches and thousands in wasted budget.