Skip to content

BUG: Broken sample outputs of off-axis projection plots in docs #5080

@xshaokun

Description

@xshaokun

Bug report

Bug summary

The outputs of two samples are broken in the docs
https://yt-project.org/docs/dev/cookbook/simple_plots.html#off-axis-projection
https://yt-project.org/docs/dev/visualizing/plots.html#off-axis-projections

The same code produces the following outputs when run with yt-4.3.1

import yt

ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
L = [1, 1, 0]  # vector normal to cutting plane
north_vector = [-1, 1, 0]
prj = yt.ProjectionPlot(
    ds, L, ("gas", "density"), width=(25, "kpc"), north_vector=north_vector
)
prj.save()

galaxy0030_OffAxisProjection_density

import yt

# Load the dataset.
ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")

# Create a 15 kpc radius sphere, centered on the center of the sim volume
sp = ds.sphere("center", (15.0, "kpc"))

# Get the angular momentum vector for the sphere.
L = sp.quantities.angular_momentum_vector()

print(f"Angular momentum vector: {L}")

# Create an off-axis ProjectionPlot of density centered on the object with the L
# vector as its normal and a width of 25 kpc on a side
p = yt.ProjectionPlot(
    ds, L, fields=("gas", "density"), center=sp.center, width=(25, "kpc")
)
p.save()

galaxy0030_OffAxisProjection_density

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions