You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Does matplotlib have a utility for "normalizing" abbreviated kwargs? #3490
Does matplotlib include an official utility for "normalizing" abbreviated keyword arguments? This is useful for functions that accept style arguments, apply defaults internally, and pass the result through to mpl.
One example of an implementation is here. Does matplotlib have something like this in its API somewhere? If not, I think it would be nice to incorporate this in mpl.
Yeah... it is pretty sad, really... IIRC, essentially, as each type of
artist is made, the docstrings for the artist is scraped for the alias
information. Therefore, this information is not in a common location
because it is specific to each type of Artist. It is merely a coincidence
that many artists share common aliases for various style properties.
Now, that is not to say that such an API wouldn't be highly welcomed...
, .
For future reference: Aliases and normalizing are currently implemented via the decorator @cbook._define_aliases and the function cbook.normalize_kwargs.
Activity
tacaswell commentedon Sep 9, 2014
iirc it does so by scraping docstrings.
cc @WeatherGod
WeatherGod commentedon Sep 10, 2014
Yeah... it is pretty sad, really... IIRC, essentially, as each type of
artist is made, the docstrings for the artist is scraped for the alias
information. Therefore, this information is not in a common location
because it is specific to each type of Artist. It is merely a coincidence
that many artists share common aliases for various style properties.
Now, that is not to say that such an API wouldn't be highly welcomed...
, .
On Tue, Sep 9, 2014 at 4:03 PM, Thomas A Caswell notifications@github.com
wrote:
petehuang commentedon Jan 2, 2017
The referenced example in the OP is gone - for my understanding what does it look like?
Perhaps related: #1963
tritemio commentedon Jan 2, 2017
tacaswell commentedon Jan 2, 2017
See https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/cbook.py#L2510
petehuang commentedon Jan 2, 2017
@tacaswell so, sounds like it exists but it's not used throughout. My search shows only
axes/_axes.pyas using it.If we want to open up a new effort to start replacing the docstring scraping functionality, we should replace this issue with a fresh one
tacaswell commentedon Jan 2, 2017
This is also tied to the traitlets work @rmorshea will be doing (so we can simply ask the artists what attributes they have).
petehuang commentedon Jan 6, 2017
For visitor reference, traitlets work sits at #4762
timhoffm commentedon Dec 9, 2018
For future reference: Aliases and normalizing are currently implemented via the decorator
@cbook._define_aliasesand the functioncbook.normalize_kwargs.