def test_mpl_preserve_image_tight():
 f = create_figure()
 exp = mplhooks.figure_to_rgb_array(f)
 (width, height) = f.canvas.get_width_height()
 s = mplhooks.figure_to_tight_array(f, (0.5 * width), (0.5 * height), True)
 obs = mplhooks.figure_to_rgb_array(f)
 plt.close(f)
 assert np.all((exp == obs))

def test_mpl_preserve_image_tight ( ) : f = create_figure ( ) exp = mplhooks . figure_to_rgb_array ( f ) ( width , height ) = f . canvas . get_width_height ( ) s = mplhooks . figure_to_tight_array ( f , ( 0.5 * width ) , ( 0.5 * height ) , True ) obs = mplhooks . figure_to_rgb_array ( f ) plt . close ( f ) assert np . all ( ( exp == obs ) )
make sure that the figure preserves height settings .