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

Skip to content

Commit 2a25fe8

Browse files
committed
Merge pull request #1103 from efiring/colorbar_lines_bug
colorbar: correct error introduced in commit 089024; closes #1102
2 parents d0c501b + 315573f commit 2a25fe8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/colorbar.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ class ColorbarBase(cm.ScalarMappable):
212212
the Axes instance in which the colorbar is drawn
213213
214214
:attr:`lines`
215-
a LineCollection if lines were drawn, otherwise None
215+
a list of LineCollection if lines were drawn, otherwise
216+
an empty list
216217
217218
:attr:`dividers`
218219
a LineCollection if *drawedges* is True, otherwise None
@@ -495,8 +496,9 @@ def add_lines(self, levels, colors, linewidths, erase=True):
495496
col = collections.LineCollection(xy, linewidths=linewidths)
496497

497498
if erase and self.lines:
498-
for lc in self.lines.pop():
499+
for lc in self.lines:
499500
lc.remove()
501+
self.lines = []
500502
self.lines.append(col)
501503
col.set_color(colors)
502504
self.ax.add_collection(col)

0 commit comments

Comments
 (0)