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
Backport PR #24677: FIX: do not replace the Axes._children list object
Manual backport due to conflicts, which were just additional tests in
main from #23861, so simply removed these.
  • Loading branch information
ksunden authored and rcomer committed Dec 9, 2022
commit fe900c59ea290b87796b736eb65fd1cbf38cdeed
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):
for ax in self.parasites:
Expand Down
11 changes: 11 additions & 0 deletions lib/mpl_toolkits/tests/test_axes_grid1.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,3 +568,14 @@ def test_rgb_axes():
g = rng.random((5, 5))
b = rng.random((5, 5))
ax.imshow_rgb(r, g, b, interpolation='none')


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()