Skip to content

Commit b49b922

Browse files
committed
FIX: remove colorbar from list of colorbars on axes if colorbar is removed
1 parent e205ce1 commit b49b922

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/matplotlib/colorbar.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,8 @@ def remove(self):
995995
if hasattr(self.ax, '_colorbar_info'):
996996
parents = self.ax._colorbar_info['parents']
997997
for a in parents:
998-
a._colorbars.remove(self.ax)
998+
if self.ax in a._colorbars:
999+
a._colorbars.remove(self.ax)
9991000

10001001
self.ax.remove()
10011002

0 commit comments

Comments
 (0)