Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
yt-project
GitHub Repository: yt-project/yt
Path: blob/main/doc/source/cookbook/colormaps.py
928 views
1
import yt
2
3
# Load the dataset
4
ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
5
6
# Create a projection and save it with the default colormap ('cmyt.arbre')
7
p = yt.ProjectionPlot(ds, "z", ("gas", "density"), width=(100, "kpc"))
8
p.save()
9
10
# Change the colormap to 'cmyt.dusk' and save again. We must specify
11
# a different filename here or it will save it over the top of
12
# our first projection.
13
p.set_cmap(field=("gas", "density"), cmap="cmyt.dusk")
14
p.save("proj_with_dusk_cmap.png")
15
16
# Change the colormap to 'hot' and save again.
17
p.set_cmap(field=("gas", "density"), cmap="hot")
18
p.save("proj_with_hot_cmap.png")
19
20