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

Skip to content

Commit ef7c674

Browse files
author
productivememberofsociety666
committed
HostAxesBase now adds appropriate _remove_method to its parasite axes.
1 parent 8a2aab2 commit ef7c674

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/mpl_toolkits/axes_grid1/parasite_axes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ def get_aux_axes(self, tr, viewlim_mode="equal", axes_class=None):
255255
# note that ax2.transData == tr + ax1.transData
256256
# Anthing you draw in ax2 will match the ticks and grids of ax1.
257257
self.parasites.append(ax2)
258+
ax2._remove_method = lambda h: self.parasites.remove(h)
258259
return ax2
259260

260261

@@ -325,6 +326,7 @@ def twinx(self, axes_class=None):
325326

326327
ax2 = parasite_axes_class(self, sharex=self, frameon=False)
327328
self.parasites.append(ax2)
329+
ax2._remove_method = lambda h: self.parasites.remove(h)
328330

329331
# for normal axes
330332

@@ -359,6 +361,7 @@ def twiny(self, axes_class=None):
359361

360362
ax2 = parasite_axes_class(self, sharey=self, frameon=False)
361363
self.parasites.append(ax2)
364+
ax2._remove_method = lambda h: self.parasites.remove(h)
362365

363366
self.axis["top"].toggle(all=False)
364367
self.axis["top"].line.set_visible(True)
@@ -399,6 +402,7 @@ def twin(self, aux_trans=None, axes_class=None):
399402
viewlim_mode="transform",
400403
)
401404
self.parasites.append(ax2)
405+
ax2._remove_method = lambda h: self.parasites.remove(h)
402406

403407

404408
# for normal axes

0 commit comments

Comments
 (0)