Skip to content

fix: secondary y axis match and visibility when faceted#32

Merged
FBumann merged 3 commits intomainfrom
fix/secondary-y-axis
Jan 28, 2026
Merged

fix: secondary y axis match and visibility when faceted#32
FBumann merged 3 commits intomainfrom
fix/secondary-y-axis

Conversation

@FBumann
Copy link
Owner

@FBumann FBumann commented Jan 28, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Secondary y-axis titles in multi-facet plots now display on the rightmost axis for improved clarity.
  • Documentation

    • Updated documentation to reflect current functionality.

✏️ Tip: You can customize this high-level summary in your review settings.

@FBumann FBumann enabled auto-merge (squash) January 28, 2026 09:35
@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The PR modifies secondary y-axis title placement and configuration in multi-faceted plots. Changes ensure axis titles appear on the rightmost secondary axis instead of the first one, with corresponding adjustments to axis anchoring, visibility controls, and layout linkage logic. Documentation and test expectations are updated accordingly.

Changes

Cohort / File(s) Summary
Documentation
README.md
Removed mention of add_trace() from the bullet under "Figure utilities (facet/animation-aware)".
Core Implementation
xarray_plotly/figures.py
Refactored secondary y-axis configuration in add_secondary_y: added logic to identify rightmost x-axis and primary y-axis, introduced rightmost_secondary_y tracking, reworked axis anchoring via x_for_y mapping, added showticklabels visibility control (enabled only on rightmost axis), implemented matches parameter for consistent scaling across non-rightmost axes, and restricted title assignment to the rightmost secondary axis.
Tests
tests/test_figures.py
Updated test expectations for multi-facet secondary y-axis title placement: changed expected axis from yaxis4 (first secondary) to yaxis6 (rightmost secondary).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 With axes aligned from left to right,
The rightmost title shines so bright,
Multi-facets dance in perfect grace,
Each secondary finds its place!

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@FBumann FBumann merged commit 10da229 into main Jan 28, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant