Skip to content

Commit cda7776

Browse files
committed
Merge pull request #4203 from endolith/colormap_synonyms_in_examples
DOC : Colormap synonyms in examples, fix errors caused by removing duplicates
2 parents c1a749a + 5296ceb commit cda7776

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
lines changed

doc/users/plotting/colormaps/grayscale.py

+12-10
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,23 @@
2525

2626
# Have colormaps separated into categories: http://matplotlib.org/examples/color/colormaps_reference.html
2727

28-
cmaps = [('Sequential', ['binary', 'Blues', 'BuGn', 'BuPu', 'gist_yarg',
28+
cmaps = [('Sequential', ['Blues', 'BuGn', 'BuPu',
2929
'GnBu', 'Greens', 'Greys', 'Oranges', 'OrRd',
3030
'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu',
3131
'Reds', 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd']),
32-
('Sequential2', ['afmhot', 'autumn', 'bone', 'cool', 'copper',
33-
'gist_gray', 'gist_heat', 'gray', 'hot', 'pink',
32+
('Sequential (2)', ['afmhot', 'autumn', 'bone', 'cool', 'copper',
33+
'gist_heat', 'gray', 'hot', 'pink',
3434
'spring', 'summer', 'winter']),
3535
('Diverging', ['BrBG', 'bwr', 'coolwarm', 'PiYG', 'PRGn', 'PuOr',
36-
'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn', 'seismic']),
37-
('Qualitative', ['Accent', 'Dark2', 'hsv', 'Paired', 'Pastel1',
38-
'Pastel2', 'Set1', 'Set2', 'Set3', 'spectral']),
39-
('Miscellaneous', ['gist_earth', 'gist_ncar', 'gist_rainbow',
40-
'gist_stern', 'jet', 'brg', 'CMRmap', 'cubehelix',
41-
'gnuplot', 'gnuplot2', 'ocean', 'rainbow',
42-
'terrain', 'flag', 'prism'])]
36+
'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn', 'Spectral',
37+
'seismic']),
38+
('Qualitative', ['Accent', 'Dark2', 'Paired', 'Pastel1',
39+
'Pastel2', 'Set1', 'Set2', 'Set3']),
40+
('Miscellaneous', ['gist_earth', 'terrain', 'ocean', 'gist_stern',
41+
'brg', 'CMRmap', 'cubehelix',
42+
'gnuplot', 'gnuplot2', 'gist_ncar',
43+
'nipy_spectral', 'jet', 'rainbow',
44+
'gist_rainbow', 'hsv', 'flag', 'prism'])]
4345

4446
# indices to step through colormap
4547
x = np.linspace(0.0, 1.0, 100)

doc/users/plotting/colormaps/lightness.py

+21-23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'''
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.
35
'''
46

57
import colorconv as color
@@ -24,21 +26,23 @@
2426

2527
# Have colormaps separated into categories: http://matplotlib.org/examples/color/colormaps_reference.html
2628

27-
cmaps = [('Sequential', ['binary', 'Blues', 'BuGn', 'BuPu', 'gist_yarg',
29+
cmaps = [('Sequential', ['Blues', 'BuGn', 'BuPu',
2830
'GnBu', 'Greens', 'Greys', 'Oranges', 'OrRd',
2931
'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu',
3032
'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',
3335
'spring', 'summer', 'winter']),
3436
('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'])]
4246

4347
# indices to step through colormap
4448
x = np.linspace(0.0, 1.0, 100)
@@ -48,10 +52,10 @@
4852

4953
# Do subplots so that colormaps have enough space. 5 per subplot?
5054
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)':
5258
dsub = 6
53-
elif cmap_category == 'Sequential2':
54-
dsub = 7
5559
elif cmap_category == 'Sequential':
5660
dsub = 7
5761
nsubplots = int(np.ceil(len(cmap_list)/float(dsub)))
@@ -85,22 +89,16 @@
8589
ax.axis([-0.1,4.7,0,100])
8690
locs.append(x[-1]+j*dc) # store locations for colormap labels
8791

88-
elif cmap_category=='Sequential2':
92+
elif cmap_category=='Sequential (2)':
8993
dc = 1.15
9094
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])
9596
locs.append(x[-1]+j*dc) # store locations for colormap labels
9697

9798
elif cmap_category=='Diverging':
9899
dc = 1.2
99100
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])
104102
locs.append(x[int(x.size/2.)]+j*dc) # store locations for colormap labels
105103

106104
elif cmap_category=='Qualitative':

0 commit comments

Comments
 (0)