Hi!

My apologies for not getting to this sooner.

I think this is likely going to be the case because how the system is set
up at present.  *However*, it can be worked around, and I think that in the
future we will build this in directly.

You can create a very thin off-axis projection using this:

https://yt-project.org/doc/visualizing/plots.html#off-axis-projection-plots

which should work with this dataset.  The width argument is described like
this in the docs:

    width : float or list of floats
        The current width of the image.  If a single float, the volume is
        cubical, but if not, it is left/right, top/bottom, front/back

So if you supply a left/right, top/bottom, then the third element will be
the depth of the projection.  Can you give that a shot and see how it works
for you?

-Matt

On Thu, Mar 7, 2024 at 8:31 AM 缘 边 <[email protected]> wrote:

> Hi I've recently started using yt for visualizing the gas density of TNG
> galaxies with an OffAxisSlicePlot. I want the top of the image to align
> with the galaxy's velocity direction [0.9196489, 0.15788311, -0.35960928],
> so I set north_vector = [0.9196489, 0.15788311, -0.35960928]. The
> projection direction is the normal vector perpendicular to the galaxy's
> velocity direction.
>
> Here's my code snippet:
> c = ds.arr([Subhalo["SubhaloPos"][0], Subhalo["SubhaloPos"][1],
> Subhalo["SubhaloPos"][2]], "code_length")
> a = np.array([0.9196489, 0.15788311, -0.35960928])
>
> # Choose a simple vector that is not collinear with 'a'
> b = np.array([0, 0, 1])  # For example, the unit vector along the z-axis
>
> # Calculate the cross product to get the perpendicular vector
> v_perpendicular = np.cross(a, b)
>
> slc = yt.SlicePlot(ds, v_perpendicular, ("gas","density"), width=(300,
> "kpc"), center=c, north_vector=a)
>
>
> However, I keep encountering this error:
> YTNonIndexedDataContainer: The data container type (ParticleContainer) is
> an unindexed type. Operations such as ires, icoords, fcoords, and fwidth
> will not work on it. Did you just attempt to perform an off-axis operation?
> Be sure to consult the latest documentation to see whether the operation
> you tried is actually supported for your data type.
>
> Has anyone faced a similar issue or can suggest a workaround? Is there a
> specific approach to making off-axis plots for particle data in yt?
> _______________________________________________
> yt-users mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/yt-users.python.org/
> Member address: [email protected]
>
_______________________________________________
yt-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/yt-users.python.org/
Member address: [email protected]

Reply via email to