Enclosure #
~5 min
What happens when you can’t use proximity and separation to group your data? For instance, in a scatterplot, you can’t just move the data points. In a photo, you can’t change where people are standing. How do you show a relationship between items that are fixed or far apart?
You put a fence around them. This is the principle of enclosure.
As a species, we are instinctively comfortable with containers. We have containers for food, money, people, ideas, etc. Everywhere we look, we are confronted with items designed to hold other items. As such a container—or an enclosure—is something we readily identify.
Consider, for instance, the random collection of objects shown below:
Is there a rhyme or reason in this figure? Is there any particular grouping? Probably as shown, it is hard to decide. However, if we do something as simple as put a shaded area around a subset of these objects, it will be clear what we wish to be perceived as associated together, and this will invite the viewer to think about why this might be.
Of course, enclosure is not the only way that we can accomplish this linking of objects. In the page on proximity and separation, we saw that we can force people to see groupings of these objects by placing them close together. In the page on alignment we also saw that simply making a spatial connection can do the same. Both of those approaches create this linking without any additional elements added. However, there are times we are not able to change the arrangement of objects on a page (for instance, the $xy$ values of our data), and this is when enclosure becomes an important tool to understand.
Consider photographs. We cannot really just move people around in the photograph. But if we want to indicate that two people are associated with one another, it feels natural to use some sort of outline to group objects together.
In the photo above, you probably just assume that the woman in front is in some kind of special relationship with the man behind and to the left. But there is really no reason to assume that, other than the fact that they are connected by this enclosure. In fact, this is an AI generated image, and these are not real people and have no relationship to one another! The story you are telling yourself about these two ‘people’ is all via the suggestive power of enclosure.
Enclosure in data visualizations #
1. Highlighting a Subset of Data #
When you can’t change your data’s position, enclosure is the best way to call out a specific region of interest.
Let’s say you had a scatterplot of the median housing price in the USA since 2000, and you wanted to call out the collapse of the housing market around 2008. You have a spectrum of options that would use enclosure to highlight this collapse, from subtle to strong:
-
Outline: A simple line around the points. It’s clear, but can sometimes add clutter if your plot already has lines.
-
Filled Shape: Using a semi-transparent shaded area is often a cleaner, less cluttered solution.
-
Fill + Outline: A stronger, more emphasized version that combines the strengths and weaknesses of the above two..
-
Inverted Fill: The strongest effect, using the data’s own color to create a high-contrast “cutout.”
The reason to consider these different approaches is that you don’t aways need to reach for the strongest effect… sometimes subtlety is desired.
2. Grouping (or “Unitizing”) Annotations #
The second powerful use of enclosure is to collect multiple, separate pieces of text into a single, logical block. This might be commonly encountered when thinking about annotations of data visualizations.
Imagine you fit an exponential growth to this data, and then wanted to label the model used, the parameters extracted, and the goodness of fit. You could just place the annotations on the plot. Using and helps link them to the fit line.
This is good, but the three lines of text (the equation, parameters, etc.) are still three separate things. By placing them inside an enclosure (like a colored box), you “unitize” them. They become one thing: “the model information.”
This makes the entire plot feel cleaner and easier to parse.
Concluding thoughts #
Enclosure is the “brute force” tool for showing associations. While proximityAndSeparation and alignment use subtle spatial arrangements to suggest relationships, enclosure draws a literal line that says “these things belong together.”
Its unique power is that it works even when your elements can’t be moved.
Use it to highlight a region of your plot, or to group disparate annotations into a single, clean unit. It’s an essential tool for imposing order and telling your story.