Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
yt-project
GitHub Repository: yt-project/yt
Path: blob/main/doc/source/cookbook/overplot_particles.py
928 views
1
import yt
2
3
# Load the dataset.
4
ds = yt.load("Enzo_64/DD0043/data0043")
5
6
# Make a density projection centered on the 'm'aximum density location
7
# with a width of 10 Mpc..
8
p = yt.ProjectionPlot(ds, "y", ("gas", "density"), center="m", width=(10, "Mpc"))
9
10
# Modify the projection
11
# The argument specifies the region along the line of sight
12
# for which particles will be gathered.
13
# 1.0 signifies the entire domain in the line of sight
14
# p.annotate_particles(1.0)
15
# but in this case we only go 10 Mpc in depth
16
p.annotate_particles((10, "Mpc"))
17
18
# Save the image.
19
# Optionally, give a string as an argument
20
# to name files with a keyword.
21
p.save()
22
23