|
1 | 1 | '''
|
2 |
| -For each colormap, plot the lightness parameter L* from CIELAB colorspace along the y axis vs index through the colormap. Colormaps are examined in categories as in the original matplotlib gallery of colormaps. |
| 2 | +For each colormap, plot the lightness parameter L* from CIELAB colorspace |
| 3 | +along the y axis vs index through the colormap. Colormaps are examined in |
| 4 | +categories as in the original matplotlib gallery of colormaps. |
3 | 5 | '''
|
4 | 6 |
|
5 | 7 | import colorconv as color
|
|
24 | 26 |
|
25 | 27 | # Have colormaps separated into categories: http://matplotlib.org/examples/color/colormaps_reference.html
|
26 | 28 |
|
27 |
| -cmaps = [('Sequential', ['binary', 'Blues', 'BuGn', 'BuPu', 'gist_yarg', |
| 29 | +cmaps = [('Sequential', ['Blues', 'BuGn', 'BuPu', |
28 | 30 | 'GnBu', 'Greens', 'Greys', 'Oranges', 'OrRd',
|
29 | 31 | 'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu',
|
30 | 32 | 'Reds', 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd']),
|
31 |
| - ('Sequential2', ['afmhot', 'autumn', 'bone', 'cool', 'copper', |
32 |
| - 'gist_gray', 'gist_heat', 'gray', 'hot', 'pink', |
| 33 | + ('Sequential (2)', ['afmhot', 'autumn', 'bone', 'cool', 'copper', |
| 34 | + 'gist_heat', 'gray', 'hot', 'pink', |
33 | 35 | 'spring', 'summer', 'winter']),
|
34 | 36 | ('Diverging', ['BrBG', 'bwr', 'coolwarm', 'PiYG', 'PRGn', 'PuOr',
|
35 |
| - 'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn', 'seismic']), |
36 |
| - ('Qualitative', ['Accent', 'Dark2', 'hsv', 'Paired', 'Pastel1', |
37 |
| - 'Pastel2', 'Set1', 'Set2', 'Set3', 'spectral']), |
38 |
| - ('Miscellaneous', ['gist_earth', 'gist_ncar', 'gist_rainbow', |
39 |
| - 'gist_stern', 'jet', 'brg', 'CMRmap', 'cubehelix', |
40 |
| - 'gnuplot', 'gnuplot2', 'ocean', 'rainbow', |
41 |
| - 'terrain', 'flag', 'prism'])] |
| 37 | + 'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn', 'Spectral', |
| 38 | + 'seismic']), |
| 39 | + ('Qualitative', ['Accent', 'Dark2', 'Paired', 'Pastel1', |
| 40 | + 'Pastel2', 'Set1', 'Set2', 'Set3']), |
| 41 | + ('Miscellaneous', ['gist_earth', 'terrain', 'ocean', 'gist_stern', |
| 42 | + 'brg', 'CMRmap', 'cubehelix', |
| 43 | + 'gnuplot', 'gnuplot2', 'gist_ncar', |
| 44 | + 'nipy_spectral', 'jet', 'rainbow', |
| 45 | + 'gist_rainbow', 'hsv', 'flag', 'prism'])] |
42 | 46 |
|
43 | 47 | # indices to step through colormap
|
44 | 48 | x = np.linspace(0.0, 1.0, 100)
|
|
48 | 52 |
|
49 | 53 | # Do subplots so that colormaps have enough space. 5 per subplot?
|
50 | 54 | dsub = 5 # number of colormaps per subplot
|
51 |
| - if cmap_category == 'Diverging': # because has 13 colormaps |
| 55 | + if cmap_category == 'Diverging': # because has 12 colormaps |
| 56 | + dsub = 6 |
| 57 | + elif cmap_category == 'Sequential (2)': |
52 | 58 | dsub = 6
|
53 |
| - elif cmap_category == 'Sequential2': |
54 |
| - dsub = 7 |
55 | 59 | elif cmap_category == 'Sequential':
|
56 | 60 | dsub = 7
|
57 | 61 | nsubplots = int(np.ceil(len(cmap_list)/float(dsub)))
|
|
85 | 89 | ax.axis([-0.1,4.7,0,100])
|
86 | 90 | locs.append(x[-1]+j*dc) # store locations for colormap labels
|
87 | 91 |
|
88 |
| - elif cmap_category=='Sequential2': |
| 92 | + elif cmap_category=='Sequential (2)': |
89 | 93 | dc = 1.15
|
90 | 94 | ax.scatter(x+j*dc, lab[0,:,0], c=x, cmap=cmap, s=300, linewidths=0.)
|
91 |
| - if i==0: |
92 |
| - ax.axis([-0.1,8.1,0,100]) |
93 |
| - else: |
94 |
| - ax.axis([-0.1,7.0,0,100]) |
| 95 | + ax.axis([-0.1,7.0,0,100]) |
95 | 96 | locs.append(x[-1]+j*dc) # store locations for colormap labels
|
96 | 97 |
|
97 | 98 | elif cmap_category=='Diverging':
|
98 | 99 | dc = 1.2
|
99 | 100 | ax.scatter(x+j*dc, lab[0,:,0], c=x, cmap=cmap, s=300, linewidths=0.)
|
100 |
| - if i==0: |
101 |
| - ax.axis([-0.1,7.1,0,100]) |
102 |
| - else: |
103 |
| - ax.axis([-0.1,6,0,100]) |
| 101 | + ax.axis([-0.1,7.1,0,100]) |
104 | 102 | locs.append(x[int(x.size/2.)]+j*dc) # store locations for colormap labels
|
105 | 103 |
|
106 | 104 | elif cmap_category=='Qualitative':
|
|
0 commit comments