Enclosure

Enclosure #

last modified February 24, 2026

~5 minute read

What happens when you cannot use proximity and separation to group your data? For instance, in a scatterplot, you cannot simply move the data points. 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, and more. 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:


8 yellow circles, all are the same size and are randomly distributed in space. Each contains a number: 24, 93, 12, 31, 17, 77, 41, and 54.
A random distribution of items with no clear grouping.


Is there a rhyme or reason in this figure? Is there any particular grouping? 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 immediately becomes clear which objects we wish to be perceived as associated. This invites the viewer to consider why this might be.


The same figure as above, but now a shaded region has been added that contains the shapes with the number 17, 31, and 41.
The addition of a shaded enclosure immediately associates a subset of the shapes, despite their spatial separation.


Of course, enclosure is not the only way to accomplish this linking. In the section on proximity and separation, we saw that we can compel people to see groupings by placing objects close together. In the section on alignment, we saw that creating a spatial connection does the same. Both of those approaches create groupings without adding new visual elements. However, there are times we cannot change the arrangement of objects on a page (for instance, the $x, y$ values of our data), and this is when enclosure becomes an essential tool.

Consider photographs. We cannot simply move people around within a picture. But if we want to indicate that two people are associated with one another, it feels natural to use an outline to group them together.


A photograph of 6 people. They are standing on a beach on a sunny day.  The person on the back left and in the front left are enclosed in a hand drawn elispse.
Even in an unchangeable image like a photograph, enclosure can strongly suggest a relationship between distant elements.


In the photo above, you probably assume that the woman in front has some kind of special relationship with the man behind and to the left. However, there is no reason to assume that, other than the fact that they are connected by this enclosure. In fact, this is an AI-generated image; these are not real people and have no relationship to one another. The story you are telling yourself about these two “people” exists entirely due to the suggestive power of enclosure.

Enclosure in data visualizations #

1. Highlighting a Subset of Data #

When you cannot 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 highlight the collapse of the housing market around 2008. You have a spectrum of options to use enclosure, ranging from subtle to strong:

  1. Outline: A simple line around the points. It is clear, but can sometimes add clutter if your plot already has lines.

A scatterplot of the median house price in the USA, from 2000 to 2023. The trend in the data is mostly upwards, with a fairly severe dip between 2008 and 2013. In the scatterplot, these points are enclosed within a rectangle with rounded points and the words “Mortgage Collapse” labels the outside of this rectangle. The rectangle is drawn using the same line width and color that connects the data points
An outline creates clear enclosure but adds line clutter to the plot.


  1. Filled Shape: Using a semi-transparent shaded area is often a cleaner, less cluttered solution.

The same plot as above, but now the rectangle does not have an outline, instead it is shaded.
Using a semi-transparent filled shape produces a cleaner, less cluttered enclosure.


  1. Fill + Outline: A stronger, more emphasized version that combines the strengths and weaknesses of the above two.

The same plot as above, but now the rectangle is both shaded and has an outline.
Combining line and fill makes the strongest assertion but risks overpowering the data itself.


  1. Inverted Fill: The strongest effect, using the data’s own color to create a high-contrast “cutout.”

The same plot as above, but now the rectangle is filled with the exact same color as the markers and lines for the data.  So, when the data crosses into this rectangle, it now changes from colored to white.
An inverted fill is the strongest effect, utilizing high-contrast cutouts to firmly group internal points.


The reason to consider these different approaches is that you do not always 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 is commonly encountered when thinking about annotations in 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 proximity and color helps link them to the fit line.


A plot of the median home price in the USA from 2000 to 2023. In addition to the data, there is a line that shows the fit of an equation to the data.  The equation was $y = A\cdot\exp(k(x = 2000))+C$ Also shown are the values of the parameters associated with this line: A = 34605, k = 0.0965, C = 204777. Also shown the fit line and parameters are shown in orange, the data is in blue.
Separate text elements positioned near each other can still feel disconnected.


This is good, but the three lines of text (the equation, parameters, etc.) are still three separate items. By placing them inside an enclosure (like a colored box), you “unitize” them. They become one thing: “the model information.”


The same plot as above, but now the parameters are given in white, within a rectangle that is filled with the same color orange as the line it labels.
Enclosing the text elements into a container visually groups them into a single, cohesive unit.


This makes the entire plot feel cleaner and easier to parse.

Concluding thoughts #

Enclosure is the “brute force” tool for showing associations. While proximity and separation 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 cannot be moved.

Use it to highlight a region of your plot or to group disparate annotations into a single, clean unit. It is an essential tool for imposing order and telling your story.

Key takeaways #

  • Enclosure overcomes static layouts: When you cannot move objects to show association, placing a boundary around them explicitly groups them.
  • Vary the strength: Enclosure can be applied subtly (using a soft shading) or aggressively (using an inverted cutout). Tailor the strength to match the importance of the data.
  • Unitize your annotations: If you have multiple lines of text or related labels, place them inside a common container. This turns them into a single visual block instead of scattered text.

page last modified February 24, 2026