Implement Figure-level overlay architecture with two-pass drawing - #32199
Implement Figure-level overlay architecture with two-pass drawing#32199Vikash-Kumar-23 wants to merge 4 commits into
Conversation
5da353c to
3dcb434
Compare
| fig._draw_base_layer = lambda renderer: None | ||
| fig.patch.set_alpha(0.0) | ||
| ax.patch.set_alpha(0.0) | ||
|
|
There was a problem hiding this comment.
I think you need three tests here:
- base
- overlay
- composite
b/c if you have to knock out the patch on the overlay, that seems to indicate you're not getting clean independence.
ksunden
left a comment
There was a problem hiding this comment.
The main idea for this review is to push towards making the layering system more generic. Instead of just one overlay, it is possible to extend into more, which has the added benefit of enabling us to clean up the code and reduce duplicated code.
I've laid out a series of specific changes that I think will add up to making this more useful and cleaner, outlined below.
3dcb434 to
e31aff1
Compare
e31aff1 to
d78afb3
Compare
|
@ksunden @story645 Thanks for the feedback! I've updated the architecture based on your suggestion to make Here are the updates pushed in the latest commit:
|
| self._children_by_layer = { | ||
| "patch": [self.patch], | ||
| "base": self._children, | ||
| } |
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:
_children_by_layerdictionary inFigureBase. Artists are now routed to distinct lists based on their layer (e.g.,"base","overlay"), andself.patchhas been isolated into its own dedicated"patch"layer.Figure.draw()andSubFigure.draw()to execute in multiple passes using a new, generic_draw_layer(renderer, layer_name)method. The strict sequence is now:"patch"layer: Renders the figure background first."base"layer: Renders all standard artists."overlay"layer: Renders all overlay artists last.layer=Nonekeyword-only argumentadd_artistandget_childrenAddresses #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