Python matplotlib.pyplot 模块,fignum_exists() 实例源码

我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用matplotlib.pyplot.fignum_exists()

项目:HORD    作者:ilija139    | 项目源码 | 文件源码
def on_running(self, xdata, ydata):
        if not plt.fignum_exists(self.figure.number):
            self.on_launch(self.min_x, self.max_x)

        self.lines.set_xdata(xdata)
        ycummin = np.minimum.accumulate(ydata)
        self.lines.set_ydata(ycummin)
        ymin = np.amin(ycummin)
        ymax = np.amax(ycummin)
        if ymin == ymax:
            ymax += 1
        self.ax.set_ylim(ymin - 0.1*(ymax - ymin), ymax + 0.1*(ymax - ymin))
        self.pts.set_xdata(xdata)
        self.pts.set_ydata(ydata)
        self.ax.relim()
        self.ax.autoscale_view()
        self.figure.canvas.draw()
        self.figure.canvas.flush_events()

# ============================= Helpers =============================
项目:style_transfer    作者:crowsonkb    | 项目源码 | 文件源码
def display(self, image):
        if self.imsh is None or not plt.fignum_exists(self.imsh.figure.number):
            self.imsh = plt.imshow(image, interpolation='nearest')
            self.imsh.axes.axis('off')
            self.imsh.axes.set_position((0, 0, 1, 1))
            self.imsh.figure.canvas.draw()
        else:
            self.imsh.set_data(image)
        plt.pause(1e-4)
项目:latenttrees    作者:kaltwang    | 项目源码 | 文件源码
def get_axes(self, id_axes):
        if self.figure is None or (not plt.fignum_exists(self.figure.number)):
            # create figure and axes
            self.figure, self.axes = plt.subplots(nrows=1, ncols=self.required_axes_total, squeeze=True, figsize=(20, 6.66))
        axes_curr = [self.axes[id] for id in id_axes]
        for ax in axes_curr:
            ax.cla()
        return axes_curr