Skip to content

fix: add_secondary_yaxis didnt preserve layout (range_y, ...)#21

Merged
FBumann merged 1 commit intomainfrom
fix/secondary-axis-fix
Jan 22, 2026
Merged

fix: add_secondary_yaxis didnt preserve layout (range_y, ...)#21
FBumann merged 1 commit intomainfrom
fix/secondary-axis-fix

Conversation

@FBumann
Copy link
Owner

@FBumann FBumann commented Jan 22, 2026

Fixed. The issue was that _merge_frames and _merge_secondary_y_frames… #21 weren't preserving the layout property of animation frames (which contains range_y).

Changes:

  • figures.py: Added layout=base_frame.layout to go.Frame() in both merge functions
  • test_figures.py: Added 2 new tests for frame layout preservation

Summary by CodeRabbit

  • Bug Fixes
    • Frame layout (axis ranges) is now correctly preserved when combining figures with overlays and secondary y-axes across animated frames.

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

… weren't preserving the layout property of animation frames (which contains range_y).

  Changes:
  - figures.py: Added layout=base_frame.layout to go.Frame() in both merge functions
  - test_figures.py: Added 2 new tests for frame layout preservation
@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The pull request preserves frame layout (axis ranges) when merging figures with overlays and secondary y-axes across animated frames. Implementation changes are made in two frame-merging functions, with corresponding test coverage added to verify layout preservation behavior.

Changes

Cohort / File(s) Summary
Frame Layout Preservation
xarray_plotly/figures.py
Modified _merge_frames and _merge_secondary_y_frames functions to include layout=base_frame.layout when creating new Frame objects, ensuring base frame layout is retained in merged frames.
Layout Preservation Tests
tests/test_figures.py
Added test coverage for layout preservation in overlay and secondary y-axes workflows, verifying that frame layout is maintained across animated frames with animation_frame and range_y specifications.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Frame by frame, a layout so neat,
Preserved through merges, the trick so sweet,
With axes aligned and ranges just right,
The animations dance in perfect sight! ✨

✨ 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 changed the title Fixed. The issue was that _merge_frames and _merge_secondary_y_frames… fix: add_secondary_yaxis didnt preserve layout (range_y, ...) Jan 22, 2026
@FBumann FBumann enabled auto-merge (squash) January 22, 2026 16:48
@FBumann FBumann merged commit c59f901 into main Jan 22, 2026
8 of 9 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