File: cmap_images.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 (16 lines) | stat: -rw-r--r-- 441 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import matplotlib as mpl

import yt

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

# Create projections using each colormap available.
p = yt.ProjectionPlot(ds, "z", "density", weight_field="density", width=0.4)

for cmap in mpl.colormaps:
    if cmap.startswith("idl"):
        continue
    p.set_cmap(field="density", cmap=cmap)
    p.annotate_title(cmap)
    p.save(f"Projection_{cmap.replace(' ', '_')}.png")