Skip to content

Feature Request: Add Ridgeline Plot Support #450

@cvanelteren

Description

@cvanelteren

Description

Add native support for ridgeline plots (also known as joyplots) to UltraPlot. Ridgeline plots are useful for visualizing distributions across multiple categories or time periods, where each distribution is plotted as a filled curve slightly overlapping the one below it.

Motivation

Ridgeline plots are increasingly popular for:

  • Visualizing multiple distributions simultaneously
  • Showing changes in distributions over time
  • Comparing density distributions across categories
  • Creating visually appealing data storytelling (famously used for Joy Division's "Unknown Pleasures" album cover)

Currently, creating ridgeline plots requires manual manipulation of multiple axes, making it difficult to achieve consistent styling and spacing.

Proposed API

import ultraplot as uplt
import numpy as np

# Simple interface
fig, ax = uplt.subplots()
data = [np.random.normal(i, 1, 1000) for i in range(5)]
ax.ridgeline(data, labels=['Group A', 'Group B', 'Group C', 'Group D', 'Group E'])

# Or with more control
fig, ax = uplt.subplots()
ax.ridgeline(
    data,
    labels=['Group A', 'Group B', 'Group C', 'Group D', 'Group E'],
    overlap=0.5,  # How much curves overlap (0-1)
    fill=True,
    alpha=0.7,
    colors='viridis',  # Use colormap
    bandwidth=0.3,  # KDE bandwidth
)

Desired Features

  • Automatic spacing and overlap control
  • Support for both KDE and histogram-based ridgelines
  • Integration with UltraPlot's color cycle and styling
  • Optional baseline coloring/shading
  • Support for both vertical and horizontal orientations
  • Ability to customize individual ridges

Related Work

Additional Context

This would complement UltraPlot's existing distribution visualization tools (violin plots, box plots, etc.) and align with the library's goal of making complex visualizations simple.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions