-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprint_colormaps.py
More file actions
31 lines (25 loc) · 1.26 KB
/
Copy pathprint_colormaps.py
File metadata and controls
31 lines (25 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import matplotlib.pyplot as plt
import numpy as np
def print_colormaps():
maps = ['twilight', 'twilight_shifted', 'hsv', 'ocean', 'gist_earth', 'terrain',
'gist_stern', 'gnuplot', 'gnuplot2', 'CMRmap',
'cubehelix', 'brg', 'gist_rainbow', 'rainbow', 'jet',
'nipy_spectral', 'gist_ncar', 'viridis', 'plasma', 'inferno', 'magma', 'cividis',
'Greys', 'Purples', 'Blues', 'Greens', 'Oranges', 'Reds',
'YlOrBr', 'YlOrRd', 'OrRd', 'PuRd', 'RdPu', 'BuPu',
'GnBu', 'PuBu', 'YlGnBu', 'PuBuGn', 'BuGn', 'YlGn',
'binary', 'gist_yarg', 'gist_gray', 'gray', 'bone',
'pink', 'spring', 'summer', 'autumn', 'winter', 'cool',
'Wistia', 'hot', 'afmhot', 'gist_heat', 'copper',
'PiYG', 'PRGn', 'BrBG', 'PuOr', 'RdGy', 'RdBu', 'RdYlBu',
'RdYlGn', 'Spectral', 'coolwarm', 'bwr', 'seismic']
colors = []
for map in maps:
cmap = plt.get_cmap(map)
wheel = [(int(c[1]), int(c[0]), int(c[2])) for c in 255 * cmap(np.linspace(0, 1, 100))]
colors.append(wheel)
print(f"{map} = {wheel}")
prints = [f"'{name}': {name}" for name in maps]
print(f"maps = {{ {', '.join(prints)} }}")
if __name__ == "__main__":
print_colormaps()