Implement Figure-level overlay architecture with two-pass drawing - #32199
Vikash-Kumar-23 wants to merge 12 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:
|
|
From the peanut gallery: We now have blend groups and modes #31162, and this is adding "layers" which is potentially similar to those. It would be useful to add some documentation on when a user would want to use one versus the other and also to make sure we are consistent in how we want to handle and thread these things through so they play nicely together and make sense from the defaults and argument names when appropriate. Maybe more critically my question is: Do we need a multi-pass drawing architecture here or should this actually be handled at the rendering level similar to what was done with the blend groups. |
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