HAHS.
Back to Catalog

Ridgeline Plot

chart

Also known as: joy plot, joyplot, ridgeline chart, stacked density plot

Show distributionCompare NumericalCategorical Line/Area

Description

A ridgeline plot (also known as a joy plot, after the famous Joy Division album cover) arranges a series of density curves or smoothed histograms along a categorical axis, with each curve offset vertically so they partially overlap. This stacking creates a mountain-range silhouette that invites the eye to scan across groups and spot differences in distribution shape, center, and spread at a glance.

The overlapping design is the key innovation: by allowing curves to share vertical space, ridgeline plots accommodate far more categories than violin plots or faceted histograms before the display becomes cluttered. A typical ridgeline plot can comfortably show 10-30 groups, whereas the same data shown as side-by-side violins or small-multiple histograms would require much more space. The trade-off is that portions of some curves may be occluded by neighbors, so the ordering of categories matters.

Ridgeline plots are especially popular for showing how a distribution evolves over time (e.g., temperature distribution by month, or song duration by decade). They work best when the viewer needs to perceive overall shape differences rather than make precise numerical comparisons between specific groups.

Ridgeline Plot — interactive example

When to Use

  • Comparing the shape of distributions across many groups (10-30 categories)
  • Showing how a distribution evolves over an ordered dimension like time or geography
  • Revealing multimodality, skewness, or shifting centers across categories at a glance
  • Creating a visually striking summary of distributional change for presentations

When NOT to Use

  • When precise density comparison between groups matters — use violin plots with aligned baselines
  • When you have very few groups (fewer than 5) — small multiples of histograms or box plots are clearer
  • When the tails of distributions are critical — overlapping can occlude tails; use faceted histograms instead
  • When the audience needs exact percentile values — use a box plot
  • When distributions are very similar — the overlapping layout makes subtle differences hard to spot

Anatomy

  • Density curves: Smoothed distributions (kernel density estimates or smoothed histograms), one per group
  • Vertical offset: Each curve is shifted upward along the category axis so curves partially overlap
  • Baseline: Each curve has its own baseline; the area below the curve is typically filled
  • Category axis: The axis along which groups are arranged (usually vertical, with groups labeled on the left)
  • Value axis: The continuous measurement axis shared by all curves (usually horizontal)
  • Fill color: Often a gradient or categorical color to distinguish groups or encode an ordinal variable

Variations

  • Ridgeline histogram: Uses stepped histogram bars instead of smooth density curves
  • Gradient ridgeline: Fill color varies along the value axis (e.g., blue-to-red for temperature)
  • Ridgeline with rug: Small tick marks below each curve show individual data points
  • Circular ridgeline: Curves wrap around a circle, useful for cyclical data like hours of day
  • Interactive ridgeline: Hovering highlights one group and dims others, solving the occlusion problem

Code Reference

// Observable Plot - faceted density approximation
// (True ridgeline requires custom positioning;
// this uses faceting as the closest Plot equivalent)
Plot.plot({
  facet: {data, y: "group", marginLeft: 80},
  fy: {domain: groups, padding: -0.4},
  marks: [
    Plot.areaY(data, Plot.binX(
      {y: "count"},
      {x: "value", fill: "group", curve: "basis", fillOpacity: 0.7}
    )),
    Plot.ruleY([0])
  ]
})