Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
As discussed in#21874, there aren't reprs on the locators and formatters. Reprs of the form where eval(repr) = call, something like
eval('AutoDateLocator(maxticks=8)')=AutoDateLocator(maxticks)
would mean reprs could be used in the documentation examples, which would help keep the labels in sync. This is useful for the new example#21874 &
- https://matplotlib.org/devdocs/gallery/ticks/tick-formatters.html
- https://matplotlib.org/devdocs/gallery/ticks/tick-locators.html
and possibly reproducibility
I think it's a good first issue 'cause it's fairly standalone and rote if you know classes, only potential difficulty might be in storing the original args:
When I try
AutoDateLocator.__repr__ = lambda self: f'AutodateLocator(maxticks={self.maxticks})'
thenrepr(AutoDateLocator(maxticks=8))
returns'AutodateLocator(maxticks={0: 8, 1: 8, 3: 8, 4: 8, 5: 8, 6: 8, 7: 8})'
, i.e. the class variablemaxticks
. I don't know how to get the value passed in during the function call. But even if this is possible, I find defining all therepr
rather verbose and a bit hacky as compared to a simpleeval
.Originally posted by@StefRe in#21874 (comment)