GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||
GeezerVison is showing github.com — FIX: Prevent crash when removing a subfigure containing subplots by Vikash-Kumar-23 · Pull Request #31323 · matplotlib/matplotlib Conversation
Contributor
Closes #31319 ## PR summary This PR fixes a crash reported in #31319 that occurs when removing a subfigure after creating subplots inside it. ### Why is this change necessary? Calling `.remove()` on a `SubFigure` can currently raise: ```pytb AttributeError: 'list' object has no attribute '_mouseover_set' This makes subfigure removal unreliable in otherwise valid figure layouts. What problem does it solve?It prevents What is the reasoning for this implementation?
Minimal self-contained example (repro / verification)import matplotlib matplotlib.use("Agg") # for reproducibility/headless runs import matplotlib.pyplot as plt fig = plt.figure() subfigs = fig.subfigures(1, 2) subfigs[0].subplots() subfigs[0].remove() print("OK: no crash") What changed (only 2 files)
How to test locallypython -m pytest lib/matplotlib/tests/test_figure.py -k test_subfigure_remove -q AI DisclosureI used AI assistance to help draft the PR description and verification steps. The code changes and local verification were performed and reviewed by me. PR checklist
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
QuLogic
approved these changes
rcomer
approved these changes
Uh oh!
There was an error while loading. Please reload this page.
meeseeksmachine
pushed a commit
to meeseeksmachine/matplotlib
that referenced
this pull request
…igure containing subplots
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
rcomer
added a commit
that referenced
this pull request
…323-on-v3.10.x Backport PR #31323 on branch v3.10.x (FIX: Prevent crash when removing a subfigure containing subplots)
This was referenced
Closed
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabelsDevelopmentSuccessfully merging this pull request may close these issues. [Bug]: Crash when removing a subfigure with a subplot in a figureUh oh!
There was an error while loading. Please reload this page. 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. | ||||
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |