Skip to content

Is it a better solution to access one of the spines by class attribute? #17100

Closed

Description

@y9c

hiding spines is very common in creating a new plot by matplotlib, and the flowing lines of code are widely used.

ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)

They are a little comprehensive for new users to remember, and is easy to get wrong.

Will it possible to access the spine by class attribute and make matplotlib more object-oriented, with this mirror change.

ax.spines.top.set_visible(False)
ax.spines.right.set_visible(False)

or even,

ax.spines.top = None
ax.spines.right = None

Activity

  1. added this to the v3.3.0 milestone on Apr 12, 2020
  2. modified the milestones: v3.3.0, v3.4.0 on May 7, 2020
  3. nmay231 commented on Jul 3, 2020

    @nmay231

    Additionally, it would be convenient to modify all spines with a catchall attribute.

    ax.spines.all.set_visible(False)

    (Though, this might need to be moved to its own issue)

  4. timhoffm commented on Jul 4, 2020

    @timhoffm
    Member

    ax.spines.all.set_visible(False) is addressed in #17107.

  5. nmay231 commented on Jul 4, 2020

    @nmay231

    Neat! Thanks @timhoffm 👍

  6. QuLogic commented on Jan 27, 2021

    @QuLogic
    Member

    Seems like this was implemented by #17107.

  7. changed the title [-]Is it a better solution to acess one of the spines by class atrribute?[/-] [+]Is it a better solution to access one of the spines by class attribute?[/+] on Apr 22, 2021
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: changesChanges to the public API, typically requiring deprecation.Documentation

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions