-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FIX: new date rcParams weren't being evaluated #17869
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes the original issue.
a7abf30
to
20a599b
Compare
20a599b
to
3c84dc3
Compare
This looks OK and I wouldn't block it, but I wonder whether it would be cleaner to move |
My concern wth that is it becomes even more mysterious how the units registry works for dates. I also am not sure that the import can happen at the beginning of rcsetup.py. But I get confused by the import order to be honest. |
@@ -1926,6 +1926,8 @@ class _rcParam_helper: | |||
@classmethod | |||
def set_converter(cls, s): | |||
"""Called by validator for rcParams date.converter""" | |||
if s not in ['concise', 'auto']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use cbook._check_in_list()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s
is just a string, not a dict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_check_in_list
doesn't check dict
s?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would work:
cbook._check_in_list(['concise', 'auto'], s=s)
The example in the docstring is misleading; as far as I can see, this would rarely if ever be called with more than one keyword argument. The reason it requires a keyword argument is that this supplies a name for the variable when reporting the error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good enough for now. My refactoring suggestion can be deferred or ignored.
Yeah, its not necessarily a bad suggestion - I just didn't fully grok it. |
PR Summary
Closes #17867
#17022 introduced new rcparams for dates. However, this changed the registration mechanism for dates and broke date plotting if the entry was not in the users matplotlibrc.
This new version fixes that logic (and adds a bit more argument checking)
PR Checklist