Skip to content

cannot remove spines when using axes_grid1 after twin operation #6831

Closed as not planned
@ocehugo

Description

@ocehugo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.status: inactiveMarked by the “Stale” Github Actiontopic: mpl_toolkit

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions