Hierarchical Facets: Advanced Layouts for Small Multiples

Many real-world datasets aren’t flat — they’re organized into nested groups such as regions within country, products within broader categories, or species within a genus or family. Hierarchical facets help you reflect this structure directly in your visualizations, so viewers can navigate complex groupings without getting lost.

In this lesson, you’ll learn how to build multi-level facet layouts, customize strip labels to keep them readable and informative, and use nested structures to clarify relationships between groups.

Members only9 minutes read

Before You Start 🧰

We’re using Rethink Sans and Domine again in this lesson to make these plots look their best. You should have the typefaces installed by now — but if not, please install them on your system to ensure everything renders correctly in the sandbox.

🪜 The Grid Upgrade

In the previous lesson, we used facet_wrap() and facet_grid() to split our data into neat, digestible multiples. While the ggplot2's defaults for the strips work well for exploration of numeric variables — let's say a group of scatterplots or time series — standard facets often struggle with hierarchy when comparing nested categories for two specific reasons:

  • Flat Visual Weight — By default, ggplot2 gives strip and axis text a similar importance. Due to the missing clear visual distinction, the logical order of information is less clear.

As stressed in several lessons before:

 Hierarchy is everything  in the world of (data) communication.

Hierarchy is the secret sauce for "scannability" and visual pruning: it ensures readers can navigate your graphic and jump directly to the major group of interest before searching for a specific item.

Oh no! 😱

It seems like you haven’t enrolled in the course yet!

Join many other students today and become the ggplot2 expert your company needs!


Enroll

Or Login

← Previous

Small Multiples

Next →

Multi-Plot Layouts