コード例 #1
0
def test_bbox_size():
    # Test for the size of a WCSAxes bbox
    fig = plt.figure()
    ax = WCSAxes(fig, [0.1, 0.1, 0.8, 0.8])
    fig.add_axes(ax)
    fig.canvas.draw()
    renderer = fig.canvas.renderer
    ax_bbox = ax.get_tightbbox(renderer)
    assert np.allclose(ax_bbox.x0, 11.38888888888889)
    assert np.allclose(ax_bbox.x1, 576)
    assert np.allclose(ax_bbox.y0, 3.5)
    assert np.allclose(ax_bbox.y1, 432)
コード例 #2
0
ファイル: test_misc.py プロジェクト: indranilm256/astropy
def test_bbox_size(atol):
    # Test for the size of a WCSAxes bbox (only have Matplotlib >= 3.0 now)
    extents = [11.38888888888889, 3.5, 576.0, 432.0]

    fig = plt.figure()
    ax = WCSAxes(fig, [0.1, 0.1, 0.8, 0.8])
    fig.add_axes(ax)
    fig.canvas.draw()
    renderer = fig.canvas.renderer
    ax_bbox = ax.get_tightbbox(renderer)

    # Enforce strict test only with reference Freetype version
    if atol < 0.1 and not FREETYPE_261:
        pytest.xfail("Exact BoundingBox dimensions are only ensured with FreeType 2.6.1")
    assert np.allclose(ax_bbox.extents, extents, atol=atol)
コード例 #3
0
def test_bbox_size():
    # Test for the size of a WCSAxes bbox
    x0 = 11.38888888888889
    y0 = 3.5
    # Upper bounding box limits (only have Matplotlib >= 3.0 now)
    x1 = 576.0
    y1 = 432.0

    fig = plt.figure()
    ax = WCSAxes(fig, [0.1, 0.1, 0.8, 0.8])
    fig.add_axes(ax)
    fig.canvas.draw()
    renderer = fig.canvas.renderer
    ax_bbox = ax.get_tightbbox(renderer)
    assert np.allclose(ax_bbox.x0, x0)
    assert np.allclose(ax_bbox.x1, x1)
    assert np.allclose(ax_bbox.y0, y0)
    assert np.allclose(ax_bbox.y1, y1)