Data Visualization and Storytelling
Explore and communicate insights with clear, accessible visuals using Matplotlib, Seaborn, and Plotly.
Content
Faceting and Small Multiples
Versions:
Watch & Learn
AI-discovered learning video
Sign in to watch the learning video for this topic.
Faceting and Small Multiples — Compare Many Plots at Once
This is the moment where the concept finally clicks: instead of stuffing everything into one messy plot, you give each slice its own tidy stage.
You’ve already seen heatmaps & correlation matrices and time series visualizations in this course. Now imagine you need to compare the same chart across many groups — regions, products, customer segments, or model cohorts. That’s where faceting (a.k.a. small multiples) becomes your storytelling superpower.
Faceting lets you split a dataset into subplots that share the same visual grammar so comparisons become immediate and trustworthy. While heatmaps and time series taught you how to read a single complex view, small multiples let you read many of the same view side-by-side.
What is faceting (and why it matters)?
- Faceting = creating multiple small plots (panels) from the same chart type, each showing a subset of the data.
- Small multiples is Edward Tufte’s elegant term: identical charts repeated for different slices of data.
Why use them?
- People compare patterns far better across small, consistent charts than across a single overloaded plot.
- Enable multi-panel stories: before/after, region-by-region, product-by-product, cohort-by-cohort.
- Reduce visual clutter and avoid misinterpretation from overplotting or too many colors.
When to facet vs. when to color / interact
- Facet when you want to compare shape, trend, or distribution of the same variables across discrete groups.
- Color when you want to show within-panel comparisons (but limited to a few categories).
- Use interactive faceting (dashboards) when the number of groups is large and the user needs to select subsets.
Quick rule of thumb
If you have more than ~6–8 categories, consider arranging facets into pages or adding interactivity — otherwise you’ll get tiny, unreadable panels.
Build-up from previous modules (pro tips)
- From "Data Cleaning & Feature Engineering": make sure your time index is cleaned, missing values handled, and group-level aggregates are computed before faceting. If you facet by a derived feature, ensure that feature wasn’t created using future information (no leakage).
- From "Time Series Visualizations": faceting is one of the best ways to compare time series across groups — keep axes consistent unless you intentionally want to highlight relative scale differences.
- From "Heatmaps & Correlations": you can create small-multiple heatmaps (one correlation matrix per subgroup) to compare relationships across groups.
Practical steps — a mini recipe
Prepare data
- Clean dates and categorical values.
- Aggregate to the appropriate grain (daily → weekly, hourly → daily) to avoid noisy micro fluctuations.
- Create facet-friendly features (e.g., cohort, region_level, product_category).
Choose the facet variable(s)
- Single facet: facet by region.
- Two-way grid: facet rows = product_category, facet cols = region.
Decide axis sharing
- Share x-axis for time series almost always.
- Share y-axis for direct magnitude comparison. Use independent y only if comparing shape regardless of magnitude.
Layout & ordering
- Use meaningful order (time, size, alphabetical if nothing else).
- Use col_wrap to avoid very wide figures.
Annotate and emphasize
- Add a consistent title per facet or a super-title.
- Use small annotations to mark important events.
Test at presentation size
- Shrink the figure to the size people will view and check readability.
Code examples (Python)
1) Seaborn small multiples for time series (sales by region)
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# sample pipeline: cleaned and aggregated dataframe
# df has columns: date, region, product, revenue
df['date'] = pd.to_datetime(df['date'])
df = df.set_index('date').resample('W').sum().reset_index() # weekly
sns.set_style('whitegrid')
# relplot gives an easy faceting API
sns.relplot(
data=df,
x='date', y='revenue',
col='region', col_wrap=3,
kind='line', height=3, aspect=1.6,
facet_kws={'sharey': True, 'sharex': True}
)
plt.subplots_adjust(top=0.92)
plt.suptitle('Weekly Revenue by Region — Small Multiples')
plt.show()
2) Plotly express (interactive faceting)
import plotly.express as px
fig = px.line(
df, x='date', y='revenue', color='product',
facet_col='region', facet_col_wrap=3,
title='Interactive revenue by region & product'
)
fig.update_layout(height=600)
fig.show()
3) Multiple heatmaps (correlations per segment)
segments = df['segment'].unique()
fig, axes = plt.subplots(nrows=len(segments), figsize=(8, 3*len(segments)))
for ax, seg in zip(axes, segments):
corr = df[df['segment'] == seg].loc[:, ['feat1','feat2','feat3']].corr()
sns.heatmap(corr, ax=ax, vmin=-1, vmax=1, cmap='vlag', cbar=False)
ax.set_title(f'Correlation — {seg}')
plt.tight_layout()
plt.show()
Design considerations and common pitfalls
- Don’t lie with axes. Changing y-axis scales across facets can dramatically mislead comparisons. If you change scales, label it clearly.
- Too many facets = tiny facets. If you have dozens of groups, consider sampling, pagination, or interactive filters.
- Order matters. Humans spot trends better when panels are ordered by a meaningful metric (size, time, or peak response).
- Consistent color mapping. Use the same color palette across all facets for consistent meaning.
- Legends: avoid repeating legends in every facet. One global legend is usually better.
- Annotations: annotate only the most important panels/events — otherwise clutter returns.
- Data leakage caution: if you engineered a feature by peeking at the target (from the previous module), faceting by that feature will amplify leakage effects visually. Ensure features are legitimate.
Storytelling with small multiples — a short recipe
- Start with your main question (e.g., did region A experience the same seasonal dip as region B?).
- Choose the single plot type that answers it (line for trends, histogram for distributions).
- Facet by the category that matters to the question.
- Keep scales consistent for fair comparison.
- Highlight the one panel that supports your narrative with an annotation or color.
Key takeaways
- Faceting (small multiples) is ideal for side-by-side comparison of the same visual across groups.
- Always prepare data at the right aggregation and avoid leakage when creating facet variables.
- Use consistent axes and color semantics to preserve truthful comparisons.
- For many groups, prefer interactivity or pagination rather than tiny, unreadable panels.
Small multiples turn mountains of data into tidy little islands of insight. When in doubt, give each group its own stage.
Quick checklist before you deliver a faceted figure
- Data cleaned and aggregated
- Facet variable validated (no leakage)
- Axes sharing decided and documented
- Meaningful ordering applied
- Annotations minimal and helpful
- Test at final display size
Use faceting to make comparisons obvious, not to hide complexity. When done right, your audience will stop squinting and start nodding.
Comments (0)
Please sign in to leave a comment.
No comments yet. Be the first to comment!