-
Notifications
You must be signed in to change notification settings - Fork 818
/
Copy pathcolormaps.py
43 lines (36 loc) · 994 Bytes
/
colormaps.py
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
32
33
34
35
36
37
38
39
40
41
42
import matplotlib.pyplot as plt
import numpy as np
def colormap(cmap,filename):
n = 512
Z = np.linspace(0,1,n,endpoint=True).reshape((1,n))
size = 512,16
dpi = 72.0
figsize= size[0]/float(dpi),size[1]/float(dpi)
fig = plt.figure(figsize=figsize, dpi=dpi)
fig.patch.set_alpha(0)
plt.axes([0.,0.,1.,1.], frameon=False)
plt.xticks([]), plt.yticks([])
plt.imshow(Z,aspect='auto',cmap=cmap,origin="lower")
plt.savefig( "../figures/cmap-%s.png" % filename, dpi=dpi )
cmaps = [m for m in plt.cm.datad if not m.endswith("_r")]
cmaps.sort()
#print """
#.. list-table::
# :widths: 10 30 50
# :header-rows: 1
#
# * - Name
# - Description
# - Appearance
#
#"""
for i in range(len(cmaps)):
name = cmaps[i]
filename = name
if name == 'Spectral':
filename = 'spectral-2'
colormap(name,filename)
#print " * - %s" % name
#print " - "
#print " - .. image:: figures/cmap-%s.png" % filename
#print