GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add pie artist by robertoffmoura · Pull Request #32359 · matplotlib/matplotlib

Conversation

@robertoffmoura

@robertoffmoura robertoffmoura commented Sep 16, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This PR is a follow up to #32320. It adds a Pie artist class and deprecates PieContainer. legend.py checks for a get_legend_handles method, so compound artists can expose their handles.

Previous state:

ax._children = [wedge1, wedge2, wedge3, text1, text2, text3],
ax.patches = [wedge1, wedge2, wedge3]
ax.texts = [text1, text2, text3]
ax.containers = []
pie_container1.wedges = [wedge1, wedge2, wedge3]

State after this PR:

ax._children = [pie1],
ax.patches = []
ax.texts = []
ax.containers = []
pie1.wedges = [wedge1, wedge2, wedge3]
pie1.texts = [text1, text2, text3]

AI Disclosure

AI used to gain understanding of the existing code

  • 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
  • New features and API changes have release notes
  • Documentation complies with general and docstring guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
robertoffmoura added 10 commits September 16, 2026 19:40
@robertoffmoura
Add pie artist
14258c7
@robertoffmoura
Wire wedges and shadows through pie artist
d6c1f00
@robertoffmoura
Wire texts to pie artist
cc56b3d
@robertoffmoura
Make Pie participate in layout and autoscaling
5a2f69a
@robertoffmoura
Convert indentation to spaces
8e46532
@robertoffmoura
Run ruff format
e461515
@robertoffmoura
Create get_legend_handles protocol
f8d8686
@robertoffmoura
Add deprecated PieContainer
94d3703
@robertoffmoura
Add What's new entry, next api changes entries
769d66d
@robertoffmoura
Update .pyi files
650a4d8
@github-actions github-actions Bot added the topic: legend label Sep 16, 2026
@robertoffmoura robertoffmoura mentioned this pull request Sep 16, 2026
[ENH]: Track PieContainer in Axes.containers #32320
Open
robertoffmoura added 4 commits September 16, 2026 22:08
@robertoffmoura
Use Pie instead of PieContainer in _axes.pyi
df5151f
@robertoffmoura
Fix build documentation errors
f010f97
@robertoffmoura
Use correct PR number
91f6ec7
@robertoffmoura
Run python tools/boilerplate.py
05fa8ff
@github-actions github-actions Bot added topic: pyplot API Documentation: examples files in galleries/examples labels Sep 16, 2026
@robertoffmoura
Fix import in lib/matplotlib/pyplot.py
ec7146f
@timhoffm

timhoffm commented Sep 17, 2026

Copy link
Copy Markdown
Member

Thanks a lot for working on this. I think this PR is going in a very promising direction, in particular by making Pie a proper composite object and moving ownership of the wedges/texts under it rather than keeping them as unrelated direct children of the Axes. Though we have to carefully decide whether we can afford the related API breakage and whether we could smoothen the transition.

On a broader context, I think we need to think quite carefully about the broader object model this implies.

One question is property propagation. Once Pie is an Artist that owns other Artists, what should e.g. set_visible, set_zorder, set_alpha, transforms, clipping, picking, etc. mean for the aggregate and its children? Some of these have fairly natural group semantics, while others do not. I would prefer not to make these decisions pie-by-pie if what we are really introducing is a general notion of a compound/grouped Artist.

Relatedly, I wonder whether this points towards a broader ArtistGroup / CompoundArtist abstraction. Potentially there is a subset of the current Artist functionality that is structural—Axes/Figure association, ownership, child traversal, lifecycle, staleness, drawing order, visibility, removal, etc.—and could eventually live in a common base of both ordinary Artists and grouped Artists. A group would then not automatically inherit visual properties for which propagation semantics are unclear.

The proposed get_legend_handles() mechanism also looks useful, but I think we should validate that abstraction against the other existing aggregate plot types before making it public API: bars, errorbars, stems, and stackplots in particular have different 1-vs-N legend-entry semantics.

So overall: I think this is very much the right direction, and it gives us a concrete implementation to reason about. But because it potentially establishes a more general compound-Artist model, I would like us to spend a bit more time on those semantics before locking in the API.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@story645

story645 commented Sep 18, 2026

Copy link
Copy Markdown
Member

I would like us to spend a bit more time on those semantics before locking in the API.

I think also the interaction/boundary between data container and artist container as data containers get phased in. Attn @ksunden

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the status: needs rebase label Oct 4, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

Documentation: examples files in galleries/examples status: needs rebase topic: legend topic: pyplot API

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@robertoffmoura @timhoffm @story645
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.