Skip to content

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

Closed

Description

@danielballan

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

Activity

  1. added this to the milestone on Sep 9, 2014
  2. tacaswell commented on Sep 9, 2014

    @tacaswell
    Member

    iirc it does so by scraping docstrings.

    cc @WeatherGod

  3. WeatherGod commented on Sep 10, 2014

    @WeatherGod
    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)
    .

  4. petehuang commented on Jan 2, 2017

    @petehuang
    Contributor

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

    Perhaps related: #1963

  5. tritemio commented on Jan 2, 2017

    @tritemio
  6. petehuang commented on Jan 2, 2017

    @petehuang
    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

  7. tacaswell commented on Jan 2, 2017

    @tacaswell
    Member

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

  8. petehuang commented on Jan 6, 2017

    @petehuang
    Contributor

    For visitor reference, traitlets work sits at #4762

  9. modified the milestones: , on Oct 3, 2017
  10. timhoffm commented on Dec 9, 2018

    @timhoffm
    Member

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

  11. removed this from the future releases milestone on Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    API: consistencyConsistency of the matplotlib API, including naming, behavior, defaults, …New feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions