Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/mpl_toolkits/axes_grid1/parasite_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def draw(self, renderer):
self._children.extend(ax.get_children())

super().draw(renderer)
self._children = self._children[:orig_children_len]
del self._children[orig_children_len:]

def clear(self):
super().clear()
Expand Down
11 changes: 11 additions & 0 deletions lib/mpl_toolkits/axes_grid1/tests/test_axes_grid1.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,3 +684,14 @@ def test_imagegrid():
im = ax.imshow([[1, 2]], norm=mpl.colors.LogNorm())
cb = ax.cax.colorbar(im)
assert isinstance(cb.locator, mticker.LogLocator)


def test_removal():
import matplotlib.pyplot as plt
import mpl_toolkits.axisartist as AA
fig = plt.figure()
ax = host_subplot(111, axes_class=AA.Axes, figure=fig)
col = ax.fill_between(range(5), 0, range(5))
fig.canvas.draw()
col.remove()
fig.canvas.draw()