Skip to content

[bar-spine] Spine Plot for Two-Variable Proportions #5249

@MarkusNeusinger

Description

@MarkusNeusinger

Description

A spine plot (also called a spineplot) is a stacked bar chart where bar widths are proportional to the marginal frequency of one variable and the subdivisions within each bar show the conditional distribution of a second variable. It is a 1D specialization of mosaic plots and excels at visualizing the relationship between two categorical variables.

Applications

  • Showing survival rates across passenger classes (Titanic dataset)
  • Visualizing disease prevalence across age groups
  • Displaying customer churn rates by subscription tier
  • Comparing pass/fail rates across different test conditions

Data

  • x_category (str) — primary categorical variable (determines bar width)
  • fill_category (str) — secondary variable (stacked segments within bars)
  • count (int) — frequency for each combination
  • Size: 3–8 x-categories, 2–5 fill categories

Notes

  • Bar width proportional to marginal count of x_category
  • Segments within each bar show conditional proportions
  • All bars same height (normalized to 100%)
  • Complements the existing mosaic-categorical spec

Metadata

Metadata

Assignees

No one assigned

    Labels

    approvedApproved for implementationspec-readySpecification merged to main

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions