def create_outlined_artist(self, mask, color, **kwargs):
artist = matplotlib.patches.Polygon(xy=mask.outline - 0.5, lw=1, picker=True, fill=False, color='gray',
**kwargs)
artist.color = color
artist.mask = mask
# todo: make the branches children a polygonCollection for better performance
def set_selected(self, a):
if a is True:
self.set_linewidth(5)
self.set_edgecolor(self.color)
else:
self.set_linewidth(1)
self.set_edgecolor('gray')
artist.set_selected = types.MethodType(set_selected, artist)
self.__artists[mask] = artist
self.axes.add_artist(artist)
self.create_outlined_child_artits(parent=mask)
评论列表
文章目录