Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use a dataclass instead of a dict as a return type for boxplot()#27788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
timhoffm wants to merge1 commit intomatplotlib:main
base:main
Choose a base branch
Loading
fromtimhoffm:return-dataclass

Conversation

timhoffm
Copy link
Member

@timhoffmtimhoffm commentedFeb 13, 2024
edited
Loading

This is a prove of concept. Backward compatibility is achieved though a collections.abc.Mapping mixin. Note though, that I did not go as far as MutableMapping. If someone has written to the returned dict, they would still be broken.

open issues:

  • documentation incomplete
  • should switch usages in the matplotlib code to attributes
  • Where to put the dataclass? cbook or axes?
  • should we use silent_list to make the repr a bit nicer?
    -> not for now. There's value in having a plainlist. If we want to improve the repr, rather implement a specialrepr forBoxplotArtists. But that can be done later.

@timhoffmtimhoffm marked this pull request as draftFebruary 13, 2024 23:50
@tacaswell
Copy link
Member

This is an interesting idea!

This also seems to be a step in the right direction for maybe having this object be in the draw tree (rather than all of the parts individually).

We should also put aremove method on it that calls down to all of its children.

@timhoffm
Copy link
MemberAuthor

timhoffm commentedFeb 14, 2024
edited
Loading

Yes, we could extend this to something like an ArtistContainer, which itself can support (parts of) the Artist API. But let's start small.

@timhoffmtimhoffmforce-pushed thereturn-dataclass branch 5 times, most recently fromf6cd232 toef3d7e9CompareFebruary 16, 2024 11:19
@github-actionsgithub-actionsbot added the Documentation: examplesfiles in galleries/examples labelFeb 16, 2024
@timhoffmtimhoffmforce-pushed thereturn-dataclass branch 2 times, most recently from0968c26 to9652073CompareFebruary 16, 2024 11:27
@timhoffm
Copy link
MemberAuthor

I just realized that we haveContainer, which could be a complimentary approach. However, I think that a data class is the more simple and understandable approach (-> public concept). Also, I'm not sure we want to buy into the additional functionality ofContainer right now. And finally, the data class and an equivalent Container are API compatible for relevant operations (read-only attribute access). So I don't think adding the dataclass now would render us in an unwanted corner. We could switch to Container later.

@timhoffmtimhoffm marked this pull request as ready for reviewFebruary 16, 2024 12:19
This is a prove of concept. Backward compatibility is achieved thougha collections.abc.Mapping mixin. Note though, that I did not go as faras MutableMapping. If someone has written to the returned dict, theywould still be broken.open issues:- documentation incomplete- should switch usages in the matplotlib code to attributes- Where to put the dataclass? cbook or axes?- should we use silent_list to make the repr a bit nicer?
@timhoffmtimhoffm added this to thev3.10.0 milestoneMar 8, 2024
@timhoffmtimhoffm marked this pull request as draftMarch 8, 2024 19:00
@timhoffm
Copy link
MemberAuthor

Put to draft to rethink this approach vs. Container. Feedback welcome.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
Projects
None yet
Milestone
future releases
Development

Successfully merging this pull request may close these issues.

3 participants
@timhoffm@tacaswell@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp