예제 #1
0
def test_set_background_color():
    ds = fake_random_ds(32)
    plot = SlicePlot(ds, 2, ("gas", "density"))
    plot.set_background_color(("gas", "density"), "red")
    plot._setup_plots()
    ax = plot.plots[("gas", "density")].axes
    assert_equal(ax.get_facecolor(), (1.0, 0.0, 0.0, 1.0))
예제 #2
0
def test_set_background_color():
    ds = fake_random_ds(32)
    plot = SlicePlot(ds, 2, 'density')
    for field in ['density', ('gas', 'density')]:
        plot.set_background_color(field, 'red')
        plot._setup_plots()
        ax = plot.plots[field].axes
        if LooseVersion(matplotlib.__version__) < LooseVersion('2.0.0'):
            assert_equal(ax.get_axis_bgcolor(), 'red')
        else:
            assert_equal(ax.get_facecolor(), (1.0, 0.0, 0.0, 1.0))
예제 #3
0
파일: test_plotwindow.py 프로젝트: tukss/yt
def test_set_background_color():
    ds = fake_random_ds(32)
    plot = SlicePlot(ds, 2, "density")
    for field in ["density", ("gas", "density")]:
        plot.set_background_color(field, "red")
        plot._setup_plots()
        ax = plot.plots[field].axes
        if LooseVersion(matplotlib.__version__) < LooseVersion("2.0.0"):
            assert_equal(ax.get_axis_bgcolor(), "red")
        else:
            assert_equal(ax.get_facecolor(), (1.0, 0.0, 0.0, 1.0))