Useful Data Tips

Small Multiples (Trellis Charts)

⏱️ 25 sec read 📊 Data Visualization

Small multiples display the same chart type for different categories side-by-side. They enable easy comparison across groups while maintaining consistent scales and formatting.

Creating Small Multiples in Python

Using Seaborn FacetGrid

import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd

# Sample data: Sales by month for different regions
data = pd.DataFrame({
    'month': list(range(1, 13)) * 4,
    'sales': [100, 120, 115, 140, 160, 155, 170, 165, 180, 175, 190, 200,
              80, 90, 85, 100, 110, 105, 120, 115, 130, 125, 140, 150,
              120, 140, 135, 160, 180, 175, 190, 185, 200, 195, 210, 220,
              90, 110, 105, 125, 140, 135, 150, 145, 160, 155, 170, 180],
    'region': ['North']*12 + ['South']*12 + ['East']*12 + ['West']*12
})

# Create small multiples
g = sns.FacetGrid(data, col='region', col_wrap=2, height=3)
g.map(sns.lineplot, 'month', 'sales')
g.set_titles("{col_name} Region")
g.set_axis_labels("Month", "Sales")
plt.tight_layout()
plt.show()

Using Matplotlib Subplots

fig, axes = plt.subplots(2, 2, figsize=(12, 8), sharex=True, sharey=True)
regions = data['region'].unique()

for idx, region in enumerate(regions):
    ax = axes[idx // 2, idx % 2]
    region_data = data[data['region'] == region]

    ax.plot(region_data['month'], region_data['sales'], marker='o')
    ax.set_title(f'{region} Region')
    ax.set_xlabel('Month')
    ax.set_ylabel('Sales')
    ax.grid(True, alpha=0.3)

plt.tight_layout()
plt.show()

When to Use Small Multiples

Small Multiples for Different Chart Types

Bar Charts

# Sales by product category across regions
g = sns.FacetGrid(data, col='region', col_wrap=2)
g.map(sns.barplot, 'category', 'sales')
g.set_xticklabels(rotation=45)
plt.show()

Scatter Plots

# Price vs. quantity across different stores
g = sns.FacetGrid(data, col='store', col_wrap=3)
g.map(sns.scatterplot, 'price', 'quantity')
g.add_legend()
plt.show()

Histograms

# Distribution of scores by department
g = sns.FacetGrid(data, col='department', col_wrap=3)
g.map(plt.hist, 'score', bins=20)
plt.show()

Best Practices

Advanced Example: Multi-Variable

# Small multiples by region AND product type
g = sns.FacetGrid(data,
                  col='region',
                  row='product_type',
                  height=3,
                  aspect=1.5)
g.map(sns.lineplot, 'month', 'sales')
g.add_legend()
g.set_titles(col_template="{col_name}", row_template="{row_name}")
plt.show()

In Tableau

Creating Small Multiples in Tableau:
1. Drag dimension to Columns or Rows
2. Right-click axis → Edit Axis → ensure "Include zero" matches
3. Format → Borders to add separation
4. Use "Synchronized axis" for consistent scaling

Tip: Use Ctrl+drag to duplicate sheets with same formatting

Pro Tip: Small multiples work best when comparing patterns, not absolute values. Always use the same scale on all charts to enable fair comparison. Limit to 6-12 multiples to avoid overwhelming viewers!

← Back to Visualization Tips