Create your Next Data Visualization in 6 Steps
by Roel Peters and Vinay Gahlot
Treemaps are popular business intelligence dashboards. If constructed well, they outline how the individual parts make up a whole. For instance, they can show how the stocks of an index are made up of the business units of an organization and the channels used in a marketing campaign.
In this guide, you’ll learn about what makes treemap visualizations special and how to create one on Ikigai.
What Is a Treemap Visualization?
A treemap visualization is an enclosure diagram that reveals the topology of a hierarchy to show how the quantities of the individual parts make up the whole. It uses a rectangular (or squarified) layout representing the entire aggregate and is recursively broken down into multiple levels for each categorical part.
Each level is a representation of another subcategory or dimension. Treemap visualizations can be extended to hierarchical data with any number of levels due to its recursive nature.
Each square represents a category and encodes multiple pieces of information. These categories include:
- Its surface, which visualizes the size of the measured quantity.
- Its embeddedness, which characterizes each element’s dimensions and relationship within the hierarchy.
- Its position, which describes an element’s ranking compared to its sibling elements.
- And sometimes its color, which represents an additional quantitative or categorical measure (i.e., the rate of change over a period of time).
If the rectangle is large enough, it often contains the name of the category and the additional quantitative measure.
Drawing a Treemap
There are multiple ways to construct a treemap visualization, and you can design slightly different treemaps from the same data set because the rectangle positions and dimensions are defined by the tiling algorithm of your choice. These algorithms optimize space usage and cluster related categories into larger squares.
The following algorithms are three popular methods for constructing a treemap:
1. Slice-and-dice: this classic algorithm moves from the highest to the lowest level through the hierarchy. It partitions each rectangle into the number of subcategories and alternates between horizontal layouts for odd-numbered levels and vertical layouts for even-numbered levels.
2. Squarified: the squarified algorithm’s primary goal is to shape each rectangle as a square and then arrange each element in a decreasing manner from top left to bottom right. To find the best solution, this algorithm is very computing-intensive because there are many possible configurations. Most implementations in today’s business intelligence suites return a good solution that doesn’t require much calculation time.
3. Stripped: this algorithm arranges all elements in a decreasing manner from left to right but across multiple horizontal strips.
Many visualization tools support treemaps, including:
- The squarify package, which is a Matplotlib implementation for rendering treemap charts with the squarified algorithm in Python.
- Recent versions of Plotly Express, which support the creation of interactive treemaps in Python.
- R, using the treemap package.
- Vega, which supports visualization of hierarchical data like treemaps in Julia.
- Popular business intelligence tools like Tableau, Power BI, Sisense, and Looker.
Reading a Treemap
To read and interpret a treemap, you need to first find out which quantitative variable is encoded by the surface of each rectangle. Usually, this can be found in the chart’s title, description, or legend.
Then, you can look at the groups or rectangles and establish what dimension or subcategory each level represents.
Next, find out if the algorithm ordered the rectangles and how it did that. Also, find out if they contained a ranking. If the chart is color-coded, you also need to establish its association.
Finally, use specific values and categories of interest to help you make decisions in regard to your organization’s business intelligence needs.
The Benefits of Treemaps
Treemaps can be incredibly helpful because they are versatile and can encode a lot of information. To facilitate the interpretation of complex charts, they often come with a lot of interactivity. For instance, by hovering over or clicking elements, the UI can reveal extra annotations, or the selection of individual elements can enable drill-down navigation in hierarchies with many levels.
How to Make a Treemap on Ikigai
Now that the treemap visualization has been introduced, knowing how to generate a treemap can help expand your data visualization toolbox. To make a treemap in Ikigai, the following steps need to be followed:
- Upload a dataset on the Ikigai platform. For this example, the sample data will be used (Monthwise). The uploaded data set can be found in the “Datasets” tab.
2. Create a New Chart. Now, click the 3 dots on the right top of the dataset and select “Add Chart”. A pop-up box will open, enter the chart name, select the sheet on which the data is present (if prompted), and click “Create”.
3. Arrive at the Chart Editor. A chart editor window will open after clicking on the create button. On the right panel of the Chart Editor Window, click on “Table” in the visualization type.
4. Select Treemap as Your Visualization Type. Clicking on the table button will open a window for selecting a visualization type. Search for “treemap” and select the type of treemap you want to make and click on “Select”.
5. Select your Treemap Parameters. Now, select the parameter and metrics on which you want to group the tree map and click “Run Query”.
6. Your Treemap is Ready! After clicking the run query, the tree map will be ready.
Treemaps are a great way for visualizing how the individual parts of a hierarchically structured data set make up a whole.
In this article, you learned what a treemap is and how to construct a treemap on Ikigai. Because of their complexity, there are a lot of considerations that you should take into account before creating one of your own.
About the Authors
Roel Peters is a data generalist with a special interest in making business cases using structured data and simulation techniques.
Vinay Gahlot (Customer Success Manager)
Vinay Gahlot is a Customer Success Manager at Ikigai labs where he works with the clients to make them successfully use the product. He holds an MBA degree from IIM Ahmedabad and has a passion for fitness and sustainability. After work, you will find him playing badminton, doing yoga, or fitness workouts.