Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fe900c5

Browse files
ksundenrcomer
authored andcommitted
Backport PR matplotlib#24677: FIX: do not replace the Axes._children list object
Manual backport due to conflicts, which were just additional tests in main from matplotlib#23861, so simply removed these.
1 parent 07535e1 commit fe900c5

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
for ax in self.parasites:

lib/mpl_toolkits/tests/test_axes_grid1.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,3 +568,14 @@ def test_rgb_axes():
568568
g = rng.random((5, 5))
569569
b = rng.random((5, 5))
570570
ax.imshow_rgb(r, g, b, interpolation='none')
571+
572+
573+
def test_removal():
574+
import matplotlib.pyplot as plt
575+
import mpl_toolkits.axisartist as AA
576+
fig = plt.figure()
577+
ax = host_subplot(111, axes_class=AA.Axes, figure=fig)
578+
col = ax.fill_between(range(5), 0, range(5))
579+
fig.canvas.draw()
580+
col.remove()
581+
fig.canvas.draw()

0 commit comments

Comments
 (0)