feat(plotting): shared axis labels for faceted plots#84
Conversation
Plotly Express repeats the x-axis title under every facet column and the y-axis title beside every facet row, and exposes no built-in way to fix this on an existing figure (make_subplots' x_title/y_title only work at figure creation and are not reachable from px). Add a public share_axis_labels(fig) helper that collapses repeated, identical axis titles into one centered label per axis, using annotation specs identical to plotly's built-in shared subplot titles (verified by a sync test against make_subplots output). Titles are only collapsed when actually repeated, so combined figures with differing subplot titles and secondary-y figures pass through unchanged. All plotting/accessor methods gain a shared_axis_labels kwarg, on by default; pass shared_axis_labels=False for plotly's stock behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 25 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Plotly Express repeats the x-axis title under every facet column and the y-axis title beside every facet row. Plotly has no flag to fix this on an existing figure — the only built-in (
make_subplots(x_title=..., y_title=...)) works at figure creation only and is not reachable through px (long-standing community request).This PR makes faceted plots render one shared, centered label per axis instead:
share_axis_labels(fig): collapses repeated, identical axis titles into a single label per axis, usable on any figure (raw px, overlay output, etc.)shared_axis_labelskwarg on all plotting/accessor methods, on by default; passshared_axis_labels=Falsefor plotly's stock behaviorDesign
make_subplots(x_title=, y_title=)implementation — a sync test compares against real make_subplots output, so if plotly ever changes its styling we'll knowsubplots()combinations with differing titles → unchangedsimplify_facet_titles, so facet title post-processing and shared labels composeVisual
Test plan
🤖 Generated with Claude Code