Thursday, June 8, 2023

Tree map Chart in Tableau


 A Treemap chart in Tableau is a visualization that displays hierarchical data using nested rectangles.
It represents different levels of the hierarchy through the size and color of the rectangles. The treemap is useful for visualizing the relative proportions of categories within a hierarchy. Here's a step-by-step guide on how to create a treemap in Tableau with an example.

Treemaps in Tableau

Step 1: Prepare your data

Ensure that your data is structured appropriately. It should include hierarchical data with categories and their corresponding values to be visualized in the treemap.


Step 2: Connect to your data source

Launch Tableau and connect to the data source containing your dataset. This can be an Excel file, a database, or any other supported data source.


Step 3: Create a new worksheet

In Tableau, navigate to the worksheet tab and create a new worksheet. This will serve as the canvas for building your treemap.


Step 4: Drag and drop the necessary fields

From the data pane, drag the highest level of the hierarchy (e.g., the main category) to the Columns or Rows shelf. Then, drag the next level of the hierarchy to the Color shelf. Finally, drag the measure field (e.g., sales, profit) to the Size shelf. Tableau will automatically generate the treemap based on the selected fields.


Step 5: Customize the treemap

Tableau will generate the treemap based on your selected fields. However, you can further customize it to enhance readability and provide more insights:


5.1. Adjust the size: You can modify the size of the rectangles in the treemap by adjusting the Size shelf. This can be done by changing the aggregation function or modifying the size slider.


5.2. Format the colors: Click on the "Color" options in the Marks card to modify the colors used in the treemap. You can choose different color palettes or assign specific colors to each level of the hierarchy.


5.3. Add labels: If desired, you can add labels to the rectangles in the treemap to display the category names or measure values. Simply drag the desired fields to the Label shelf.


Step 6: Save and share

Once you are satisfied with the treemap, save the workbook and share it with others. You can export the treemap as an image or publish it to Tableau Server or Tableau Public for wider distribution.


For example, let's say you have a dataset with sales data for different product categories and sub-categories. The sales figures for each sub-category are as follows:


Category A:

Subcategory 1: $10,000

Subcategory 2: $15,000

Category B:

Subcategory 3: $8,000

Subcategory 4: $12,000

Category C:

Subcategory 5: $5,000

Subcategory 6: $7,000

By following the steps mentioned above, you can create a treemap in Tableau that visually represents the hierarchy of categories and sub-categories based on their sales values. The treemap will consist of nested rectangles, with the size of each rectangle representing the sales value of the corresponding sub-category. The color of the rectangles can be used to represent the different categories. You can adjust the size, format the colors, and add labels to enhance the treemap's visual appeal and information presentation.


The resulting treemap will allow you to analyze the relative proportions of sales within each category and sub-category. You can easily identify the largest and smallest sub-categories based on their rectangle sizes, as well as understand the overall distribution of sales across different categories.

Thanks for Reading, Subscribe us for more latest Visualization From scratch. 

No comments:

Post a Comment

If you have any doubts. Please let me know

How can you create an alias for a table in a SQL query?

In SQL, you can create an alias for a table in a query to give the table a temporary, alternative name that you can use in the query. Table ...