File: colormaps.py

package info (click to toggle)
yt 4.1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 76,192 kB
  • sloc: python: 125,909; ansic: 6,303; cpp: 3,590; sh: 556; javascript: 352; makefile: 131; csh: 36
file content (18 lines) | stat: -rw-r--r-- 616 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import yt

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

# Create a projection and save it with the default colormap ('cmyt.arbre')
p = yt.ProjectionPlot(ds, "z", ("gas", "density"), width=(100, "kpc"))
p.save()

# Change the colormap to 'cmyt.dusk' and save again.  We must specify
# a different filename here or it will save it over the top of
# our first projection.
p.set_cmap(field=("gas", "density"), cmap="cmyt.dusk")
p.save("proj_with_dusk_cmap.png")

# Change the colormap to 'hot' and save again.
p.set_cmap(field=("gas", "density"), cmap="hot")
p.save("proj_with_hot_cmap.png")