diff --git a/yt/visualization/volume_rendering/off_axis_projection.py b/yt/visualization/volume_rendering/off_axis_projection.py index f31919de19..8f1f2bde48 100644 --- a/yt/visualization/volume_rendering/off_axis_projection.py +++ b/yt/visualization/volume_rendering/off_axis_projection.py @@ -445,8 +445,16 @@ def temp_weightfield(field, data): # i.e. we ignore the z-component wmax = width[:2].max() # Recenter positions w.r.t. center of the plot window - xyz = np.stack( - [data_source["index", k] - center[i] for i, k in enumerate("xyz")], axis=-1 + units = data_source["index", "x"].units + xyz = data_source.apply_units( + np.stack( + [ + data_source["index", k] - center[i].to(units) + for i, k in enumerate("xyz") + ], + axis=-1, + ), + units, ) # If we have periodic boundaries, we need to wrap the positions