-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[MNT]: Not possible to set AutoDateFormatter
rcParam to function without deprecation warning
#23012
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
Do we allow functions for any rcParams? |
Not sure. If so, only when setting it at runtime. Obviously, one cannot set a function in config files. But if there is no technical limitation I don’t See a reason why who shouldn’t allow that at run time. |
As long as the function in importable, we can do something like I suspect our logic when deprecated this was that if you can not express it in the config file, it should not go in rcparams |
I guess that the example in the documentation actually tells you how it should be done if you want a function. If I recall correctly, I was just trying to test out some things for code coverage and maybe didn't really read the documentation that much in detail, but thought that it should be possible as I probably copied some other test code... So if the conclusion is to close this as it is OK and the documentation says so, I will not argue. (Possibly one can add a note that the only way to get a function is to do as in the example, now it can, maybe, be interpreted as one way to use a function, not the way). |
I wouldn't do that unless we have very good reasons. This is a proprietary pattern users would have to learn (reduces the chance that it gets used) and we would have to maintain it. Let's not take any actions here until users are asking for it. @oscargus feel free to clarify the documentation. |
Ah, sorry. I'm against parsing functions from Matplotlibrc. It would be ok to modify the validator to support runtime-assignment. |
Summary
Not clear if it should be possible, but it is possible to use functions instead of format strings so one may think it should be possible to set the
rcParam
to a function as well. The documentation is a bit vague and do not really encourage changing them, so maybe it is not supposed to be possible.matplotlib/lib/matplotlib/dates.py
Lines 867 to 869 in 65e9620
Proposed fix
Add a "string or callable" verifier and use that.
The text was updated successfully, but these errors were encountered: