MNT: move ArtistList into artist module by rcomer · Pull Request #31794 · matplotlib/matplotlib · GitHub
Skip to content

MNT: move ArtistList into artist module#31794

Open
rcomer wants to merge 2 commits into
matplotlib:mainfrom
rcomer:standalone-artistlist
Open

MNT: move ArtistList into artist module#31794
rcomer wants to merge 2 commits into
matplotlib:mainfrom
rcomer:standalone-artistlist

Conversation

@rcomer

@rcomer rcomer commented May 31, 2026

Copy link
Copy Markdown
Member

PR summary

Make ArtistList a standalone class in the artist module, and deprecate accessing as an attribute of the axes class. This is pulled out of #31746 to make the review easier. The only changes to the AxesList class are

  • White space
  • __init__ call sequence is now on one line
  • The isinstance call in __add__ now checks for ArtistList instead of Axes.ArtistList

I suspect this will need the second commit from #31746, but I'm curious to actually see the doc failure.

AI Disclosure

No AI used.

PR checklist

@github-actions github-actions Bot added topic: axes Documentation: tutorials files in galleries/tutorials labels May 31, 2026

@timhoffm timhoffm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, much easier to review 😄.

As expected, the doc failure is the same strange inheritance-diagram related failure as in the other PR.

@rcomer rcomer force-pushed the standalone-artistlist branch from a9d220f to 8e05633 Compare May 31, 2026 14:07
@rcomer

rcomer commented May 31, 2026

Copy link
Copy Markdown
Member Author

@rcomer

rcomer commented May 31, 2026

Copy link
Copy Markdown
Member Author

Notes on second commit for second reviewer:

For some reason, modifying the artist_api.rst triggered warnings and therefore a Circle-CI failure like this. I demonstrated that removing the inheritance diagram at the top of the file made the problem go away, so that seems to be the cause but I'm unclear why the inheritance diagram has not been a problem before now.

To fix it, I went ahead and added docs for the missing private artists.

For _ImageBase and _AnnotationBase I think these are reasonable to include as they have useful methods that do not show in the docs for the public arists. E.g. get_shape, get_size, set_data on _ImageBase and get/set_annotation_clip on _AnnotationBase.

For _AxesBase I made it as unobtrusive as possible.

@rcomer rcomer changed the title MNT: move Artistlist into artist module MNT: move ArtistList into artist module May 31, 2026
@rcomer rcomer added this to the v3.12.0 milestone Jun 2, 2026

@QuLogic QuLogic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will note that all the doc problems were already listed in doc/missing-references.json, but at a different line number. So if you've fixed them, then you should remove the entries from there.

@@ -0,0 +1,3 @@
The ``Axes.AxesList`` attribute

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is AxesList?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops; fixed.

Comment thread lib/matplotlib/artist.pyi Outdated
def pprint_getters(self) -> list[str]: ...


class ArtistList(Sequence[_T_Artist]):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs updating for #31923.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@ayshih

ayshih commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

I will note that all the doc problems were already listed in doc/missing-references.json

Ah, I didn't know about that file! I had hit the same docs failures after I modified artist_api.rst in #31162, so it's great to now understand why that happened.

@rcomer

rcomer commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

I had heard of that file but never made the effort to learn what it's about! Thanks @QuLogic it's good to have an explanation.

rcomer added 2 commits June 25, 2026 20:01
The inheritance diagram in the artists API docs broke without these.
@rcomer

rcomer commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about _AxesBase here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my previous comment #31794 (comment). I’m not sure whether to remove this or revert the doc addition.

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.

4 participants