def test_line_callback(): with _cleanup_fname() as prefix: ax = "z" vector = [1.0, 1.0, 1.0] ds = fake_amr_ds(fields=("density",), units=("g/cm**3",)) p = ProjectionPlot(ds, ax, ("gas", "density")) p.annotate_line([0.1, 0.1, 0.1], [0.5, 0.5, 0.5]) assert_fname(p.save(prefix)[0]) p = SlicePlot(ds, ax, ("gas", "density")) p.annotate_line([0.1, 0.1, 0.1], [0.5, 0.5, 0.5]) assert_fname(p.save(prefix)[0]) p = OffAxisSlicePlot(ds, vector, ("gas", "density")) p.annotate_line([0.1, 0.1, 0.1], [0.5, 0.5, 0.5]) assert_fname(p.save(prefix)[0]) # Now we'll check a few additional minor things p = SlicePlot(ds, "x", ("gas", "density")) p.annotate_line([0.1, 0.1], [0.5, 0.5], coord_system="axis", color="red") p.save(prefix) check_axis_manipulation(p, prefix) with _cleanup_fname() as prefix: ds = fake_amr_ds(fields=("density",), units=("g/cm**3",), geometry="spherical") p = ProjectionPlot(ds, "r", ("gas", "density")) assert_raises( YTDataTypeUnsupported, p.annotate_line, [0.1, 0.1, 0.1], [0.5, 0.5, 0.5] ) p.annotate_line([0.1, 0.1], [0.5, 0.5], coord_system="axis") assert_fname(p.save(prefix)[0])
def test_line_callback(): with _cleanup_fname() as prefix: ax = 'z' vector = [1.0,1.0,1.0] ds = fake_amr_ds(fields = ("density",)) p = ProjectionPlot(ds, ax, "density") p.annotate_line([0.1,0.1,0.1],[0.5,0.5,0.5]) yield assert_fname, p.save(prefix)[0] p = SlicePlot(ds, ax, "density") p.annotate_line([0.1,0.1,0.1],[0.5,0.5,0.5]) yield assert_fname, p.save(prefix)[0] p = OffAxisSlicePlot(ds, vector, "density") p.annotate_line([0.1,0.1,0.1],[0.5,0.5,0.5]) yield assert_fname, p.save(prefix)[0] # Now we'll check a few additional minor things p = SlicePlot(ds, "x", "density") p.annotate_line([0.1,0.1],[0.5,0.5], coord_system='axis', plot_args={'color':'red'}) p.save(prefix)
def test_line_callback(): with _cleanup_fname() as prefix: ax = 'z' vector = [1.0, 1.0, 1.0] ds = fake_amr_ds(fields=("density", )) p = ProjectionPlot(ds, ax, "density") p.annotate_line([0.1, 0.1, 0.1], [0.5, 0.5, 0.5]) yield assert_fname, p.save(prefix)[0] p = SlicePlot(ds, ax, "density") p.annotate_line([0.1, 0.1, 0.1], [0.5, 0.5, 0.5]) yield assert_fname, p.save(prefix)[0] p = OffAxisSlicePlot(ds, vector, "density") p.annotate_line([0.1, 0.1, 0.1], [0.5, 0.5, 0.5]) yield assert_fname, p.save(prefix)[0] # Now we'll check a few additional minor things p = SlicePlot(ds, "x", "density") p.annotate_line([0.1, 0.1], [0.5, 0.5], coord_system='axis', plot_args={'color': 'red'}) p.save(prefix)
def test_line_callback(): with _cleanup_fname() as prefix: ax = 'z' vector = [1.0, 1.0, 1.0] ds = fake_amr_ds(fields=("density", )) p = ProjectionPlot(ds, ax, "density") p.annotate_line([0.1, 0.1, 0.1], [0.5, 0.5, 0.5]) assert_fname(p.save(prefix)[0]) p = SlicePlot(ds, ax, "density") p.annotate_line([0.1, 0.1, 0.1], [0.5, 0.5, 0.5]) assert_fname(p.save(prefix)[0]) p = OffAxisSlicePlot(ds, vector, "density") p.annotate_line([0.1, 0.1, 0.1], [0.5, 0.5, 0.5]) assert_fname(p.save(prefix)[0]) # Now we'll check a few additional minor things p = SlicePlot(ds, "x", "density") p.annotate_line([0.1, 0.1], [0.5, 0.5], coord_system='axis', plot_args={'color': 'red'}) p.save(prefix) with _cleanup_fname() as prefix: ds = fake_amr_ds(fields=("density", ), geometry="spherical") p = ProjectionPlot(ds, "r", "density") p.annotate_line([0.1, 0.1, 0.1], [0.5, 0.5, 0.5]) assert_raises(YTDataTypeUnsupported, p.save, prefix) p = ProjectionPlot(ds, "r", "density") p.annotate_line([0.1, 0.1], [0.5, 0.5], coord_system="axis") assert_fname(p.save(prefix)[0])