def update(self, ix=None, cutoff=None, region=None, update_canvas=True):
if region is not None:
self._new_region(region)
if ix is not None and ix != self.current_ix:
ds = self.da_sub[ix]
self.current_ix = ix
self.line.set_ydata(ds)
self.ax.set_ylim((np.nanmin(ds), np.nanmax(ds)))
if cutoff is None:
if not self.is_symmetric:
self.update(cutoff=(self.ax.get_ylim()[1]-self.ax.get_ylim()[0])/2 + self.ax.get_ylim()[0],
update_canvas=False)
else:
self.update(cutoff=self.ax.get_ylim()[1] / 2, update_canvas=False)
if update_canvas:
self.fig.canvas.draw()
if cutoff is not None and cutoff != self.current_cutoff:
if self.is_symmetric:
self.current_cutoff = abs(cutoff)
else:
self.current_cutoff = cutoff
self.cutoff_line.set_ydata(self.current_cutoff)
if self.is_symmetric:
self.cutoff_line_mirror.set_ydata(-1*self.current_cutoff)
if update_canvas:
self.fig.canvas.draw()
评论列表
文章目录