-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Open
Description
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
`.AutoDateFormatter` has a ``.scale`` dictionary that maps tick scales (the | |
interval in days between one major tick) to format strings; this dictionary | |
defaults to :: |
In [1]: mpl.rcParams['date.autoformatter.year'] = lambda a: str(a)
C:\Users\Oscar\AppData\Local\Temp\ipykernel_9940\331672118.py:1: MatplotlibDeprecationWarning: Support for setting an rcParam that expects a str value to a non-str value is deprecated since 3.5 and support will be removed two minor releases later.
mpl.rcParams['date.autoformatter.year'] = lambda a: str(a)
Proposed fix
Add a "string or callable" verifier and use that.