Data Visualization Best Practices

Chapter 1 · Practice 4 of 4

Split crowded charts into small multiples

From Start from the question and choose the chart

Why it matters

The Analysis Function notes that more than four lines often makes a line chart too cluttered, and recommends a maximum of four categories in each stacked bar and four bars per cluster. When you have more series than that, split them.

Small multiples repeat the same small chart for each category, with shared axes, so readers compare shapes without decoding colors. All three libraries support them:

  • matplotlib: plt.subplots(nrows, ncols, sharex=True, sharey=True)
  • Plotly Express: the facet_col and facet_row arguments
  • Vega-Lite: the facet encoding or the row and column channels

Example

Python
import plotly.express as px

fig = px.line(df, x="month", y="signups", facet_col="region", facet_col_wrap=3)
fig.update_yaxes(matches="y")  # shared y scale so panels compare fairly
fig.show()