Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
yt-project
GitHub Repository: yt-project/yt
Path: blob/main/doc/source/cookbook/customized_phase_plot.py
928 views
1
import yt
2
import yt.units as u
3
4
ds = yt.load("HiresIsolatedGalaxy/DD0044/DD0044")
5
6
center = [0.53, 0.53, 0.53]
7
normal = [0, 0, 1]
8
radius = 40 * u.kpc
9
height = 2 * u.kpc
10
11
disk = ds.disk(center, [0, 0, 1], radius, height)
12
13
profile = yt.create_profile(
14
data_source=disk,
15
bin_fields=[("index", "radius"), ("gas", "velocity_cylindrical_theta")],
16
fields=[("gas", "mass")],
17
n_bins=256,
18
units=dict(radius="kpc", velocity_cylindrical_theta="km/s", mass="Msun"),
19
logs=dict(radius=False, velocity_cylindrical_theta=False),
20
weight_field=None,
21
extrema=dict(radius=(0, 40), velocity_cylindrical_theta=(-250, 250)),
22
)
23
24
plot = yt.PhasePlot.from_profile(profile)
25
plot.set_cmap(("gas", "mass"), "YlOrRd")
26
27
plot.save()
28
29