Commit f2f79bf
authored
spec: add bar-spine specification (#5266)
## New Specification: `bar-spine`
Related to #5249
---
### specification.md
# bar-spine: Spine Plot for Two-Variable Proportions
## Description
A spine plot (spineplot) is a stacked bar chart where bar widths are
proportional to the marginal frequency of one categorical variable and
the subdivisions within each bar show the conditional distribution of a
second categorical variable. All bars are normalized to the same height
(100%), so visual comparison focuses on how the conditional proportions
shift across categories. It is a one-dimensional specialization of
mosaic plots and excels at revealing associations between two
categorical variables in contingency table data.
## Applications
- Showing survival rates across passenger classes in the Titanic dataset
- Visualizing disease prevalence across demographic age groups
- Displaying customer churn rates segmented by subscription tier
- Comparing pass/fail rates across different experimental test
conditions
## Data
- `x_category` (categorical) - Primary categorical variable that
determines bar width (marginal frequency)
- `fill_category` (categorical) - Secondary categorical variable shown
as stacked segments within each bar
- `count` (integer) - Frequency count for each combination of x_category
and fill_category
- Size: 3-8 x-categories, 2-5 fill categories for readability
- Example: Titanic survival data with passenger class as x_category,
survival status as fill_category, and passenger counts
## Notes
- Bar width must be proportional to the marginal count of each
x_category
- Segments within each bar represent conditional proportions of
fill_category (heights sum to 100%)
- All bars share the same total height (normalized to 100%)
- Bars should be adjacent with no gaps to emphasize the continuous
proportion axis
- Use distinct colors for each fill_category with a clear legend
- X-axis labels should be centered under each variable-width bar
- Consider adding percentage labels within segments when space permits
- Complements the existing mosaic-categorical spec as a simpler 1D
alternative
---
**Next:** Add `approved` label to the issue to merge this PR.
---
:robot: *[spec-create
workflow](https://github.com/MarkusNeusinger/pyplots/actions/runs/24290842605)*
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>1 parent 5f20d9f commit f2f79bf
2 files changed
+59
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
0 commit comments