def test_plot_tight(self): fig = self.figures[0] fig.set_tight_layout(False) # default to standard assert_equal(plot_to_frame(fig).shape[:2], (384, 512)) assert_less(plot_to_frame(fig, bbox_inches='tight').shape[:2], (384, 512)) assert_equal(plot_to_frame(fig).shape[:2], (384, 512)) fig.set_tight_layout(True) # default to tight assert_less(plot_to_frame(fig).shape[:2], (384, 512)) assert_equal(plot_to_frame(fig, bbox_inches='standard').shape[:2], (384, 512)) assert_less(plot_to_frame(fig).shape[:2], (384, 512))
def test_plot_tight(self): fig = self.figures[0] fig.set_tight_layout(False) # default to standard assert_equal(plot_to_frame(fig).shape[:2], (384, 512)) assert_less( plot_to_frame(fig, bbox_inches='tight').shape[:2], (384, 512)) assert_equal(plot_to_frame(fig).shape[:2], (384, 512)) fig.set_tight_layout(True) # default to tight assert_less(plot_to_frame(fig).shape[:2], (384, 512)) assert_equal( plot_to_frame(fig, bbox_inches='standard').shape[:2], (384, 512)) assert_less(plot_to_frame(fig).shape[:2], (384, 512))
def test_plot_resize(self): frame = plot_to_frame(self.figures[0], fig_size_inches=(4, 4)) assert_equal(frame.shape, (512, 512, 4))
def test_plot_tight(self): frame = plot_to_frame(self.figures[0], bbox_inches='tight') assert_equal(frame.shape, (384, 512, 4))
def test_plot_width(self): width = np.random.randint(100, 1000) frame = plot_to_frame(self.figures[0], width) assert_equal(frame.shape[1], width)
def test_plot_to_frame(self): frame = plot_to_frame(self.figures[0]) assert_equal(frame.shape, (384, 512, 4))
def test_ax_to_frame(self): frame = plot_to_frame(self.axes[0]) self.assertEqual(frame.shape, (384, 512, 4))