Skip to content

Commit

Permalink
check that adding an added contour has a collections member
Browse files Browse the repository at this point in the history
  • Loading branch information
newville committed Feb 6, 2025
1 parent 9a74a41 commit 19910f8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions wxmplot/imagepanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ def add_highlight_area(self, mask, label=None, col=0):
cmap._init()
except:
pass

if hasattr(cmap, '_lut'):
rgb = [int(i*240)^255 for i in cmap._lut[0][:3]]
col = '#%02x%02x%02x' % (rgb[0], rgb[1], rgb[2])
Expand All @@ -255,8 +254,10 @@ def fmt(*args, **kws): return label
colors=col, rightside_up=True)

if col is not None:
for l in area.collections:
l.set_edgecolor(col)
if hasattr(area, 'collections'):
for l in area.collections:
l.set_edgecolor(col)
area.set_edgecolor(col)
self.canvas.draw()

def set_viewlimits(self, axes=None):
Expand Down

0 comments on commit 19910f8

Please sign in to comment.