Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

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
y9c opened this issue Apr 11, 2020 · 4 comments
Closed

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

y9c opened this issue Apr 11, 2020 · 4 comments

Comments

@y9c
Copy link
Contributor

y9c commented Apr 11, 2020

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
@nmay231
Copy link

nmay231 commented Jul 3, 2020

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)

@timhoffm
Copy link
Member

timhoffm commented Jul 4, 2020

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

@nmay231
Copy link

nmay231 commented Jul 4, 2020

Neat! Thanks @timhoffm 👍

@QuLogic
Copy link
Member

QuLogic commented Jan 27, 2021

Seems like this was implemented by #17107.

@QuLogic QuLogic closed this as completed Jan 27, 2021
@QuLogic QuLogic 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? Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants