Skip to content

Implement Figure-level overlay architecture with two-pass drawing - #32199

Open
Vikash-Kumar-23 wants to merge 3 commits into
matplotlib:mainfrom
Vikash-Kumar-23:container-managed-overlays
Open

Implement Figure-level overlay architecture with two-pass drawing#32199
Vikash-Kumar-23 wants to merge 3 commits into
matplotlib:mainfrom
Vikash-Kumar-23:container-managed-overlays

Conversation

@Vikash-Kumar-23

Copy link
Copy Markdown
Contributor

PR summary

This PR introduces a foundational Figure-level overlay architecture to figure.py. It implements a two-pass drawing system, allowing developers to cleanly segregate base plot artists from overlay artists.

Key Changes:

  • Segregated Artist Storage: Introduced _overlay_children to FigureBase. Figure elements are now routed to either _children (base layer) or _overlay_children (overlay layer).
  • Two-Pass Drawing: Overhauled Figure.draw() to execute in two distinct passes:
    • _draw_base_layer(): Renders the figure patch (background) and all artists in _children.
    • _draw_overlay_layer(): Renders all artists in _overlay_children.
  • Public API Routing: Added an _overlay=False keyword-only argument to key artist insertion methods (add_artist, text, legend, figimage).
  • Title/Label Support: Plumbed the _overlay keyword through the suptitle, supxlabel, and supylabel family (via _suplabels) down to the underlying text calls.

Addresses #30515

AI Disclosure

AI tools were used to assist in drafting text and suggesting validation scenarios.
All code changes, final implementation decisions, and verification were done manually.

PR quality check

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

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.

1 participant