예제 #1
0
def test_mpl_preserve_image_tight():
    """Make sure that the figure preserves height settings"""
    f = create_figure()
    exp = mplhooks.figure_to_rgb_array(f)
    width, height = f.canvas.get_width_height()
    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)
예제 #2
0
def test_mpl_preserve_dpi():
    """Make sure that the figure preserves height settings"""
    f = create_figure()
    width, height = f.canvas.get_width_height()
    mplhooks.figure_to_tight_array(f, 0.5 * width, 0.5 * height, False)
    exp = DPI
    obs = f.dpi
    plt.close(f)
    assert exp == obs
예제 #3
0
def test_mpl_preserve_face_color():
    """Make sure that the figure preserves face color settings"""
    f = create_figure()
    width, height = f.canvas.get_width_height()
    mplhooks.figure_to_tight_array(f, 0.5 * width, 0.5 * height, True)
    exp = FACE_COLOR
    obs = f.get_facecolor()
    plt.close(f)
    assert exp == obs
예제 #4
0
def test_mpl_preserve_height():
    """Make sure that the figure preserves height settings"""
    f = create_figure()
    width, height = f.canvas.get_width_height()
    mplhooks.figure_to_tight_array(f, 0.5 * width, 0.5 * height, True)
    exp = height
    newwidth, newheight = f.canvas.get_width_height()
    obs = newheight
    plt.close(f)
    assert exp == obs
예제 #5
0
def test_mpl_preserve_font_size():
    """Make sure that matplotlib preserves font size settings"""
    f = create_figure()
    width, height = f.canvas.get_width_height()
    print(width, height)
    mplhooks.figure_to_tight_array(f, 0.5 * width, 0.5 * height, True)
    exp = FONT_SIZE
    obs = matplotlib.rcParams["font.size"]
    plt.close(f)
    assert exp == obs
예제 #6
0
def test_mpl_preserve_image_tight():
    """Make sure that the figure preserves height settings"""
    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)
예제 #7
0
def test_mpl_preserve_dpi():
    """Make sure that the figure preserves height settings"""
    f = create_figure()
    width, height = f.canvas.get_width_height()
    s = mplhooks.figure_to_tight_array(f, 0.5 * width, 0.5 * height, False)
    exp = DPI
    obs = f.dpi
    plt.close(f)
    assert exp == obs
예제 #8
0
def test_mpl_preserve_face_color():
    """Make sure that the figure preserves face color settings"""
    f = create_figure()
    width, height = f.canvas.get_width_height()
    s = mplhooks.figure_to_tight_array(f, 0.5 * width, 0.5 * height, True)
    exp = FACE_COLOR
    obs = f.get_facecolor()
    plt.close(f)
    assert exp == obs
예제 #9
0
파일: test_mpl.py 프로젝트: janschulz/xonsh
def test_mpl_preserve_font_size():
    """Make sure that matplotlib preserves font size settings"""
    f = create_figure()
    width, height = f.canvas.get_width_height()
    s = mplhooks.figure_to_tight_array(f, 0.5*width, 0.5*height, True)
    exp = FONT_SIZE
    obs = matplotlib.rcParams['font.size']
    plt.close(f)
    assert exp == obs
예제 #10
0
def test_mpl_preserve_height():
    """Make sure that the figure preserves height settings"""
    f = create_figure()
    width, height = f.canvas.get_width_height()
    s = mplhooks.figure_to_tight_array(f, 0.5 * width, 0.5 * height, True)
    exp = height
    newwidth, newheight = f.canvas.get_width_height()
    obs = newheight
    plt.close(f)
    assert exp == obs