Fix render backend issues for animating graphs#720
Merged
Conversation
…ng the established geometry on later dirty frames instead of re-running tight layout each time. Add a regression test that saves a small animation and verifies only the first save-time layout pass uses tight layout.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #718
This fixes the layout shifting reported when saving animations by making UltraPlot run a full tight-layout pass only on the first saved frame, then reuse the established geometry on later dirty frames instead of repeatedly re-running tight=True during FuncAnimation.save(). The root issue was that frame updates like axs.format(...) were marking the figure layout dirty, and the save-time canvas preprocessing was then tightening the layout again for each subsequent frame, which could cause visible position changes early in the animation, especially with writer="ffmpeg". The change lives in ultraplot/figure.py, where save-time layout processing now falls back to fig.auto_layout(tight=False) after the first saved frame, and it is covered by a regression test in ultraplot/tests/test_animation.py that saves a small animation and verifies that only the first save-time layout pass uses tight layout.