-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
1e829e8
to
7019145
Compare
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 a |
Yes, we could extend this to something like an ArtistContainer, which itself can support (parts of) the Artist API. But let's start small. |
f6cd232
to
ef3d7e9
Compare
0968c26
to
9652073
Compare
I just realized that we have |
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?
9652073
to
0130f77
Compare
Put to draft to rethink this approach vs. Container. Feedback welcome. |
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:
should we use silent_list to make the repr a bit nicer?-> not for now. There's value in having a plain
list
. If we want to improve the repr, rather implement a specialrepr
forBoxplotArtists
. But that can be done later.