# Space-Partitioning and Containment

They are used to represent hierarchical structures.

![](/files/-M5-0V2I2QJsmNFp3lJy)

The largest rectangle represents the root node of the tree, and so on.

**Tree Maps** are the most commonly-used visualization that employ containment. The following shows how to generate a tree map from a simple tree:\
![](/files/-M5-0V2Kvx9_jB6ovm_7)The areas in the resulting tree map are proportional to the node values.

**Area** can be used to encode quantity. **Color** can be used to encode both quantity (color intensity) and category (color hue). **Hierarchy** is used to encode structure/nesting.

![](/files/-M5-0V2MWmLNK_-4xb70)

Here, hierarchy represents categories, color represents average profit, size represents the total number of sales.

**Tree Maps are extremely scalable**!

However, there is a key **issue** with the **slice and dice** method: when the rectangles have **different aspect ratios** (proportion of height vs. width), it becomes **difficult to compare areas**, especially with elongated rectangles.

To combat this issue, **squarified treemaps** were introduced. In a squarified treemap, the aim os to have the aspect ratio of each rectangle as close to 1 as possible (thereby making them squares), while still filling the entire chart area. This makes it much easier to compare areas.

**Voronoi Treemaps** split the areas in a more organic manner:\
![](/files/-M5-0V2O7yunZEyjU7sh)

Even **circular treemaps** exist:\
![](/files/-M5-0V2Qgnrw6HEiV6bH)

## Treemap Advantages

* Scalability
* Node visibility
* No overlapping marks, so less clutter
* Can encode size and color

## Treemap Disadvantages

* Cannot visualize structure directly
* Comparisons of rectangles with different aspect ratios is difficult (partially fixed by using squarified treemaps and other alternatives)
* Area isn't very effective as a metric for comparison, when compared to other metrics like position


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://vikram-bajaj.gitbook.io/cs-gy-6313-information-visualization/networks-and-trees/visualizing-trees/space-partitioning-and-containment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
