Skip to content

Does matplotlib have a utility for "normalizing" abbreviated kwargs? #3490

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

Closed
danielballan opened this issue Sep 9, 2014 · 9 comments
Closed

Comments

@danielballan
Copy link
Contributor

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.

cc @tritemio

@tacaswell tacaswell added this to the v1.5.x milestone Sep 9, 2014
@tacaswell
Copy link
Member

iirc it does so by scraping docstrings.

cc @WeatherGod

@WeatherGod
Copy link
Member

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:

iirc it does so by scraping docstrings.

cc @WeatherGod https://github.com/WeatherGod


Reply to this email directly or view it on GitHub
#3490 (comment)
.

@petehuang
Copy link
Contributor

The referenced example in the OP is gone - for my understanding what does it look like?

Perhaps related: #1963

@tritemio
Copy link

tritemio commented Jan 2, 2017 via email

@tacaswell
Copy link
Member

@petehuang
Copy link
Contributor

@tacaswell so, sounds like it exists but it's not used throughout. My search shows only axes/_axes.py as 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
Copy link
Member

This is also tied to the traitlets work @rmorshea will be doing (so we can simply ask the artists what attributes they have).

@petehuang
Copy link
Contributor

For visitor reference, traitlets work sits at #4762

@tacaswell tacaswell modified the milestones: 2.1 (next point release), 2.2 (next next feature release) Oct 3, 2017
@timhoffm
Copy link
Member

timhoffm commented Dec 9, 2018

For future reference: Aliases and normalizing are currently implemented via the decorator @cbook._define_aliases and the function cbook.normalize_kwargs.

@timhoffm timhoffm closed this as completed Dec 9, 2018
@story645 story645 removed this from the future releases milestone Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants