|
2 | 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. |
3 | 3 | ''' |
4 | 4 |
|
5 | | -from skimage import io, color |
| 5 | +from skimage import color |
6 | 6 | import numpy as np |
7 | 7 | import matplotlib.pyplot as plt |
8 | 8 | from matplotlib import cm |
9 | 9 | import matplotlib as mpl |
10 | | -import pdb |
11 | | -from scipy.optimize import curve_fit |
12 | 10 |
|
13 | 11 | mpl.rcParams.update({'font.size': 14}) |
14 | 12 | mpl.rcParams['font.sans-serif'] = 'Arev Sans, Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Helvetica, Avant Garde, sans-serif' |
|
39 | 37 | 'gnuplot', 'gnuplot2', 'ocean', 'rainbow', |
40 | 38 | 'terrain', 'flag', 'prism'])] |
41 | 39 |
|
42 | | -# indices to step through colormap |
| 40 | +# indices to step through colormap |
43 | 41 | x = np.linspace(0.0, 1.0, 100) |
44 | 42 |
|
45 | 43 | # Do plot |
|
49 | 47 | dsub = 5 # number of colormaps per subplot |
50 | 48 | if cmap_category == 'Diverging': # because has 13 colormaps |
51 | 49 | dsub = 6 |
52 | | - elif cmap_category == 'Sequential2': |
| 50 | + elif cmap_category == 'Sequential2': |
53 | 51 | dsub = 7 |
54 | | - elif cmap_category == 'Sequential': |
| 52 | + elif cmap_category == 'Sequential': |
55 | 53 | dsub = 7 |
56 | 54 | nsubplots = int(np.ceil(len(cmap_list)/float(dsub))) |
57 | 55 |
|
|
63 | 61 |
|
64 | 62 | ax = fig.add_subplot(nsubplots, 1, i+1) |
65 | 63 | # pdb.set_trace() |
66 | | - |
| 64 | + |
67 | 65 | for j, cmap in enumerate(cmap_list[i*dsub:(i+1)*dsub]): |
68 | 66 |
|
69 | 67 | # Get rgb values for colormap |
|
113 | 111 | ax.scatter(x+j*dc, lab[0,:,0], c=x, cmap=cmap, s=300, linewidths=0.) |
114 | 112 | ax.axis([-0.1,6.1,0,100]) |
115 | 113 | locs.append(x[int(x.size/2.)]+j*dc) # store locations for colormap labels |
116 | | - |
| 114 | + |
117 | 115 | # Set up labels for colormaps |
118 | 116 | ax.xaxis.set_ticks_position('top') |
119 | 117 | ticker = mpl.ticker.FixedLocator(locs) |
|
0 commit comments