8000 Adjust logic in RcParams to allow for inheritance by cvanelteren · Pull Request #30245 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Adjust logic in RcParams to allow for inheritance #30245

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

Merged
merged 1 commit into from
Jul 2, 2025

Conversation

cvanelteren
Copy link
Contributor

We over at UltraPlot ran into an issue where I wanted to derrive our RcClass directly from matplotlib's RcParams. However, in the source I noticed there are two places where the class hardcodes the class itself. This PR addresses this issue by making that initialization tied to the class type, opening up the potential for direct inheritance without needing to override these methods.

Copy link
Member
@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

One a side note: There are thoughts on fundamentally reworking the rcParams mechanism (e.g. #24585, #25617). I'm not clear whether we give any guarantees that sublcassing RcParams will continue to work then. What is your motivation to subclass RcParams?

@cvanelteren
Copy link
Contributor Author

We add a bunch of custom rc flags, and I am currently in the process of unifying the way we used to do things and align them with how matplotlib is doing it. That is, I prefer to subclass it rather than providing a custom class that is currently very very messy.

@jklymak jklymak merged commit e22a6e8 into matplotlib:main Jul 2, 2025
38 of 39 checks passed
@cvanelteren
Copy link
Contributor Author

Thanks!

Is there anything I can read up on potential changes to RcParams you are considering?

@timhoffm
Copy link
Member
timhoffm commented Jul 2, 2025

Is there anything I can read up on potential changes to RcParams you are considering?

no concise summary as there’s no concrete plan yet. You can have a look at the above linked items to get some ideas.

We add a bunch of custom rc flags

So all you need is additional parameters for your library? That’s something we consider to natively support one way or the other in the future.

@cvanelteren
Copy link
Contributor Author

Ok thanks for letting me know, and great to hear. Will keep a close eye 👀

@cvanelteren cvanelteren deleted the allow-inherritance-rc branch July 2, 2025 15:39
@QuLogic QuLogic changed the title Adjust logic in RcParams to allow for inherritance Adjust logic in RcParams to allow for inheritance Jul 2, 2025
@QuLogic QuLogic added this to the v3.11.0 milestone Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0