def test_figure_io(self): vpl.close() self.assertIs(vpl.gcf(False), None) vpl.auto_figure(False) self.assertIs(vpl.gcf(), None) with self.assertRaises(vpl.figures.figure_manager.NoFigureError): vpl.screenshot_fig() fig = vpl.figure() self.assertIs(vpl.gcf(), None) del fig vpl.auto_figure(True) fig = vpl.gcf() self.assertTrue(fig is not None) self.assertIs(fig, vpl.gcf()) vpl.close() self.assertIs(vpl.gcf(False), None) vpl.scf(fig) self.assertIs(fig, vpl.gcf()) vpl.close() fig = vpl.figure() self.assertIs(fig, vpl.gcf()) vpl.close()
def test_figure_io(): vpl.close() assert vpl.gcf(False) is None vpl.auto_figure(False) assert vpl.gcf() is None with pytest.raises(vpl.figures.figure_manager.NoFigureError): vpl.screenshot_fig() fig = vpl.figure() assert vpl.gcf() is None del fig vpl.auto_figure(True) fig = vpl.gcf() assert fig is not None assert fig is vpl.gcf() vpl.close() assert vpl.gcf(False) is None vpl.scf(fig) assert fig is vpl.gcf() vpl.close() fig = vpl.figure() assert fig is vpl.gcf() vpl.close()
def quick_show(self): from vtkplotlib import gcf, scf, figure old_gcf = gcf(False) fig = figure(name=repr(self)) fig += self fig.show() scf(old_gcf)
def quick_show(self): import vtkplotlib as vpl old_fig = vpl.gcf(create_new=False) fig = vpl.figure(repr(self)) plot = self.to_plot(fig) vpl.show(fig) vpl.scf(old_fig) return plot