Closed
Description
Bug summary
from pylab import *
ax = gca()
marginal = ax.inset_axes([1, 0, .1, 1], sharey=ax)
marginal.remove()
ax.set(ylim=(10, 20))
currently fails with
AttributeError: 'NoneType' object has no attribute 'canvas'
(when trying to propagate the change to the removed inset)
Compare with removal of normal shared axes (e.g., axs = subplots(2, sharey=True); axs[1].remove(); axs[0].set(ylim=(10, 20))
which works fine.
This is because add_child_axes
makes the inset's remove_method be self.child_axes.remove
, which skips the shared-grouper-teardown code present in Figure.delaxes
.
Code for reproduction
above
Actual outcome
exception
Expected outcome
no exception
Operating system
fedora
Matplotlib Version
3.5.0.dev2434+g7eaf90b387
Matplotlib Backend
any
Python version
39
Jupyter version
No response
Other libraries
No response
Installation
No response
Conda channel
No response