Repository navigation
fix(graphics): axes_logic uses an empty current figure instead of creating a second one - #265
Open
petercorke wants to merge 1 commit into
Open
petercorke wants to merge 1 commit into
petercorke wants to merge 1 commit into
Conversation
…ating a second one axes_logic reuses the current axes when the current figure has axes, but when the current figure had none, as after a bare plt.figure(), it called plt.figure() again. Every "new plot" idiom (plt.figure() followed by a plot_xxx call) therefore left an empty figure behind, most visible with the ipympl backend where figures stay open in notebooks. Put the axes in the empty current figure instead. new=True still always makes a new figure, a dimension mismatch still makes a new figure, and a current figure that has axes is reused as before. Add direct tests of axes_logic (there were none): the existing behaviour, and the empty-current-figure cases. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This branch has not been deployed
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.
axes_logicreuses the current axes when the current figure has axes. When the current figure has none, as after a bareplt.figure(), it callsplt.figure()again, so the familiarplt.figure()followed by aplot_xxx()call leaves an empty figure behind. This is most visible with theipymplbackend in notebooks, where every figure stays open.This puts the axes in the empty current figure instead.
new=Truestill always makes a new figure, a dimension mismatch still makes a new figure, and a figure that has axes is reused as before.There were no direct tests of
axes_logic, so this adds 10: the existing behaviour and the empty-figure cases. Three fail without the change and all pass with it. Existing graphics and pose tests are unchanged.🤖 Generated with Claude Code