Open cphyc opened 1 day ago
Bug summary
When annotating plots with a sphere, the apparent size of the sphere depends on the units of the center of the plot.
Code for reproduction
import yt import numpy as np ds = yt.load_sample("output_00080") rad = ds.quan(200, "kpccm/h") # Option 1 center = ds.arr(ds.all_data().argmax("density")) # Option 2 center = ds.arr(ds.all_data().argmax("density")).in_units("code_length") # Option 3 center = ds.arr(ds.all_data().argmax("density")).in_units("Mpccm/h") sp = ds.sphere(center, 2*rad) p = yt.ProjectionPlot( ds, "x", ("gas", "density"), center=center, width=rad * 2, data_source=sp, origin="native", ) p.annotate_sphere(center, rad, circle_args={"color": "white"}) p.set_axes_unit("Mpccm/h") p.save("/tmp/")
Actual outcome
Expected outcome
All three images should be the same.
It looks exactly as if input units are completely ignored and code units are assumed in all cases.
Found the issue!
Bug report
Bug summary
When annotating plots with a sphere, the apparent size of the sphere depends on the units of the center of the plot.
Code for reproduction
Actual outcome
Expected outcome
All three images should be the same.