-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
MatplotlibDeprecationWarning when updating rcparams #20249
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
Those were all removed in 3.4.2, and indeed are not loaded. I expect you have a crossed install somehow, and maybe an old matplotlibrc kicking around. |
I thought that too at first, but I don't believe that is the case here. After more digging, it seems to be related to line 846 of __init__.py' which constructs the I suppose this is a feature to preserve behavior while in the deprecation period, but it is not expected (to me anyways). This behavior has puzzled me for years as my library reads, manipulates, and then updates rcparams (pre mplstyle era). I'd always find them even though my matplotlibrc and install was clean. I eventually countered this by maintaining a list of deprecated rcparams and popping them before my update. Not good for backward compatibility though. But then time would pass and more would crop up as versions changed and more future deprecations occurred. I finally posted here because it has become very cumbersome to manage. |
Importing just matplotlib produces no warnings. It is only after the get and update. |
For 3.4.2 the warning is:
I think that is working as we would expect, yes those entries still need to be in the dict, and yes you will get the deprecation message if you update them. I'm not sure we can do anything to fix this.... |
Seems like the conundrum for a fix was discussed in #13118. Now that I understand that behavior, it seems good. The "fix" is probably just using best practices like the Perhaps helpful to developers would be a clarification to the documentation for matplotlib.rc_params() and matplotlib.rc_params_from_file() indicating that deprecated rcparams will be inserted when loading from the matplotlibrc or other file to preserve behavior during the deprecation period. Then point them to best practice for setting global parameters in the guide here |
@gibbycu would you be willing to open a PR making the changes to those docstrings that would have saved you here? |
Bug report
Bug summary
Updating RC params in code produces a deprecation warning. In order to control rcParams for an internal library I am reading in parameters and popping some that I don't want used. I am using a variation on the code below. I think I have traced it to the _validators dictionary in matplotlib.rcsetup.py
Code for reproduction
This code reproduces the error.
Actual outcome
Expected outcome
I would expect Matplotlib to not load deprecated rcParams
Matplotlib version
Setup a conda environment and just specified matplotlib from conda-forge
The text was updated successfully, but these errors were encountered: