Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FIX: keep SVG axes siblings when ending draw with rasterized artists - #32311

Open
ShamikOfficial wants to merge 1 commit into
matplotlib:mainfrom
ShamikOfficial:fix/32174-svg-rasterized-zorder-axes
Open

FIX: keep SVG axes siblings when ending draw with rasterized artists#32311
ShamikOfficial wants to merge 1 commit into
matplotlib:mainfrom
ShamikOfficial:fix/32174-svg-rasterized-zorder-axes

Conversation

@ShamikOfficial

Copy link
Copy Markdown

PR summary

Closes #32174.

When the last artist drawn in an Axes uses rasterized=True, mixed-mode rendering can still be active when Axes.draw calls close_group('axes'). MixedModeRenderer was proxying that call to the Agg raster renderer, where close_group is a no-op. The SVG axes group therefore stayed open, so the next axes was nested inside it.

This mirrors the existing close_blend_group handling: if rasterization can be stopped (_raster_depth == 0), flush to the vector backend before closing the group. Nested close_group calls 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_group fix, and add the regression test. I reviewed the change and verified the issue reproduction and the fix locally.

PR quality check

  • Use an expressive title, e.g. "Fix title font property precedence"
  • New and changed code is tested
  • [N/A] Plotting related features are demonstrated in an example
  • [N/A] New features and API changes have release notes
  • [N/A] Documentation complies with general and docstring guidelines

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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Using rasterized=True with zorder makes the generated SVG have wrong axes layer hierarchy

2 participants