FIX: keep SVG axes siblings when ending draw with rasterized artists - #32311
Open
ShamikOfficial wants to merge 1 commit into
Open
FIX: keep SVG axes siblings when ending draw with rasterized artists#32311ShamikOfficial wants to merge 1 commit into
ShamikOfficial wants to merge 1 commit into
Conversation
Pending mixed-mode rasterization left Axes.close_group on the Agg renderer, so SVG axes groups stayed open and later axes nested inside them when artists used rasterized=True. Closes matplotlib#32174. Co-authored-by: Cursor <[email protected]>
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.
PR summary
Closes #32174.
When the last artist drawn in an Axes uses
rasterized=True, mixed-mode rendering can still be active whenAxes.drawcallsclose_group('axes').MixedModeRendererwas proxying that call to the Agg raster renderer, whereclose_groupis a no-op. The SVG axes group therefore stayed open, so the next axes was nested inside it.This mirrors the existing
close_blend_grouphandling: if rasterization can be stopped (_raster_depth == 0), flush to the vector backend before closing the group. Nestedclose_groupcalls from rasterized artists still run at_raster_depth > 0, so consecutive rasterized artists can still merge into one image.AI Disclosure
Cursor was used to help locate the mixed-mode grouping bug, implement the flush-before-
close_groupfix, and add the regression test. I reviewed the change and verified the issue reproduction and the fix locally.PR quality check