def __update_artist(self):
# check if this is the first point of a branch
if self.artist is None:
self.artist = Circle([self.x[0], self.y[0]], radius=self.r[0], fill=False,
lw=2, color='red')
self.axes.add_artist(self.artist)
elif len(self.x) == 0:
self.artist.remove()
self.artist = None
elif len(self.x) == 1:
self.artist.remove()
self.artist = Circle([self.x[0], self.y[0]], radius=self.r[0], fill=False,
lw=2, color='red')
self.axes.add_artist(self.artist)
# change from circle to polygon if more than 1 points are available
elif len(self.x) == 2:
self.artist.remove()
branch = Branch(x=self.x, y=self.y, z=[0 for i in self.x], r=self.r)
self.artist = Polygon(branch.outline, fill=False, color='red', lw=2)
self.axes.add_artist(self.artist)
else:
assert (len(self.x) > 2)
branch = Branch(x=self.x, y=self.y, z=[0 for i in self.x], r=self.r)
self.artist.set_xy(branch.outline)
评论列表
文章目录