-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: rcdefaults
and rcParams.clear()
don't work?
#25855
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
Comments
Seems like @timhoffm came across this while doing something similar in #12577 (comment)
Based on @tacaswell's comment on that, it still doesn't make sense because right now they are persisted even though the code seems to be removing them? I'm kinda confused about what exactly is the goal here. |
rcdefaults
doesn't work? rcdefaults
and rcParams.clear()
don't work?
The dict inheritance makes it confusing, as we don't actually directly implement If I call Somehow we are getting |
For completeness, here is the {
'webagg.port_retries',
'figure.raise_window',
'docstring.hardcopy',
'backend',
'backend_fallback',
'toolbar',
'figure.max_open_warning',
'date.epoch',
'timezone',
'webagg.port',
'webagg.open_in_browser',
'webagg.address',
'interactive',
'tk.window_focus',
'savefig.directory'
} |
Yep. I get that the |
I think the reason it gets the |
Basically, it feels like the "wrong" implementation is working right now? |
In general inheriting from If I do Yeah, I think that We do not test it at all. Given that it broke and nobody complained... perhaps that is a sign it should be either deprecated completely or reworked entirely as part of #25617... It perhaps gives some latitude to make changes that might otherwise have warranted a difficult to navigate deprecation dance. With the chainmap implementation (modulo the sub-dict structures) the documented behavior appears to be something like: non_style = {k: self[k] for k in STYLE_BLACKLIST}
self.maps = [defaults, non_style]
self.maps.new_child() (this is from the perspective of And of course, should get a test... |
Yeah, I think I'll redo the implementation there to match the documentation more. |
Our .clear on RcParams was working, while matplotlib was a no-op: matplotlib/matplotlib#25855 We now mirror this behaviour. Fixes #606
Our .clear on RcParams was working, while matplotlib was a no-op: matplotlib/matplotlib#25855 We now mirror this behaviour. Fixes #606
Our .clear on RcParams was working, while matplotlib was a no-op: matplotlib/matplotlib#25855 We now mirror this behaviour. Fixes #606
Our .clear on RcParams was working, while matplotlib was a no-op: matplotlib/matplotlib#25855 We now mirror this behaviour. Fixes #606
Our .clear on RcParams was working, while matplotlib was a no-op: matplotlib/matplotlib#25855 We now mirror this behaviour. Fixes #606
Our .clear on RcParams was working, while matplotlib was a no-op: matplotlib/matplotlib#25855 We now mirror this behaviour. Fixes #606
Bug summary
This is the
rcdefaults()
functionmatplotlib/lib/matplotlib/__init__.py
Lines 1068 to 1091 in 8faa835
What exactly are we trying to do here? According to the docstring, if we're trying to reset the rcParams dictionary and only reset the keys that are not in
STYLE_BLACKLIST
then there are 2 problems I think:rcParams.clear()
doesn't work. It doesn't clear out the entire dictionary.update
line,rcParams
will still have keys fromSTYLE_BLACKLIST
which, if I were to perform the same operations on a dictionary, shouldn't be the case.STYLE_BLACKLIST
but then I'm not sure whyclear()
is used and not just directly update the keys.Also, sidenote,
popitem()
errors out without a good error message (which is also why clear doesn't actually empty the dict?)Code for reproduction
Actual outcome
clear()
doesn't empty thercParams
dictionary.Expected outcome
clear()
should empty the dictionary and afterrcdefaults()
, keys fromSTYLE_BLACKLIST
shouldn't be there.Additional information
I'm not sure if this is a documentation issue and the behaviour is intended or the behaviour isn't intended.
Operating system
No response
Matplotlib Version
Current main
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
None
The text was updated successfully, but these errors were encountered: