8000 Merge pull request #24677 from tacaswell/fix/hostaxes_remove · matplotlib/matplotlib@4d52a3e · GitHub
[go: up one dir, main page]

Skip to content

Commit 4d52a3e

Browse files
authored
Merge pull request #24677 from tacaswell/fix/hostaxes_remove
FIX: do not replace the Axes._children list object
2 parents dbf3034 + 0f4ec9a commit 4d52a3e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/mpl_toolkits/axes_grid1/parasite_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def draw(self, renderer):
136136
self._children.extend(ax.get_children())
137137

138138
super().draw(renderer)
139-
self._children = self._children[:orig_children_len]
139+
del self._children[orig_children_len:]
140140

141141
def clear(self):
142142
super().clear()

lib/mpl_toolkits/axes_grid1/tests/test_axes_grid1.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,3 +684,14 @@ def test_imagegrid():
684684
im = ax.imshow([[1, 2]], norm=mpl.colors.LogNorm())
685685
cb = ax.cax.colorbar(im)
686686
assert isinstance(cb.locator, mticker.LogLocator)
687+
688+
689+
def test_removal():
690+
import matplotlib.pyplot as plt
691+
import mpl_toolkits.axisartist as AA
692+
fig = plt.figure()
693+
ax = host_subplot(111, axes_class=AA.Axes, figure=fig)
694+
col = ax.fill_between(range(5), 0, range(5))
695+
fig.canvas.draw()
696+
col.remove()
697+
fig.canvas.draw()

0 commit comments

Comments
 (0)
0