Skip to content
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

cannot remove spines when using axes_grid1 after twin operation #6831

Closed
ocehugo opened this issue Jul 26, 2016 · 3 comments
Closed

cannot remove spines when using axes_grid1 after twin operation #6831

ocehugo opened this issue Jul 26, 2016 · 3 comments
Labels
status: closed as inactive Issues closed by the "Stale" Github Action. Please comment on any you think should still be open. status: inactive Marked by the “Stale” Github Action topic: mpl_toolkit

Comments

@ocehugo
Copy link

ocehugo commented Jul 26, 2016

To help us understand and resolve your issue please check that you have provided
the information below.

  • [1.5.1,3.5.1,OSX ] Matplotlib version, Python version and Platform (Windows, OSX, Linux ...)
  • [pip ] How did you install Matplotlib and Python (pip, anaconda, from source ...)

When creating a parasite object matplotlib creates two spines, and if one need to make it invisible by toggling one of them, the only time that it's possible is just after the creation of the parasite axis. If the user try to do it after calling new_fixed_axis the extra spine cannot be removed. For example the code below cannot remove the top extra spine.

import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
import numpy as np

host = host_subplot(111,axes_class=AA.Axes)
plt.subplots_adjust(bottom=0.15)
host.plot(10,10)
nfa = host.get_grid_helper().new_fixed_axis
par1 = host.twiny()
par1.axis['bottom'] = nfa(loc='bottom',axes=par1,offset=(0,-20))
par1.spine['top'].toggle(all=False)

While this works:

import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
import numpy as np

host = host_subplot(111,axes_class=AA.Axes)
plt.subplots_adjust(bottom=0.15)
host.plot(10,10)
nfa = host.get_grid_helper().new_fixed_axis
par1 = host.twiny()
par1.spine['top'].toggle(all=False)
par1.axis['bottom'] = nfa(loc='bottom',axes=par1,offset=(0,-20))

I would not expect that the toggle would work only just after creation of the parasite.

@tacaswell
Copy link
Member

That is odd.

That part of the code base is under-tested and under-documented. Any help on it would be greatly appreciated.

@oscargus
Copy link
Contributor

I think that the current version of this is:

import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA

host = host_subplot(111,axes_class=AA.Axes)
plt.subplots_adjust(bottom=0.15)
host.plot(10,10)
nfa = host.get_grid_helper().new_fixed_axis
par1 = host.twiny()
par1.axis['bottom'] = nfa(loc='bottom',axes=par1,offset=(0,-20))
par1.spines['top'].set_visible(False)

Not fully sure what the expected outcome is, but swapping the two last lines will not change the plot (but I think that it is consistently incorrect now...).

Copy link

This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

@github-actions github-actions bot added the status: inactive Marked by the “Stale” Github Action label Nov 27, 2023
@github-actions github-actions bot added the status: closed as inactive Issues closed by the "Stale" Github Action. Please comment on any you think should still be open. label Dec 28, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: closed as inactive Issues closed by the "Stale" Github Action. Please comment on any you think should still be open. status: inactive Marked by the “Stale” Github Action topic: mpl_toolkit
Projects
None yet
Development

No branches or pull requests

3 participants