Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3c29961

Browse files
committed
Reordering the colormaps and add a few missing ones
1 parent 0c9a280 commit 3c29961

3 files changed

Lines changed: 50 additions & 48 deletions

File tree

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
# Have colormaps separated into categories:
22
# http://matplotlib.org/examples/color/colormaps_reference.html
33

4-
cmaps = [('Perceptually Uniform Sequential',
5-
['viridis', 'inferno', 'plasma', 'magma']),
6-
('Sequential', ['Blues', 'BuGn', 'BuPu',
7-
'GnBu', 'Greens', 'Greys', 'Oranges', 'OrRd',
8-
'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu',
9-
'Reds', 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd']),
10-
('Sequential (2)', ['afmhot', 'autumn', 'bone', 'cool', 'copper',
11-
'gist_heat', 'gray', 'hot', 'pink', 'spring',
12-
'Wistia', 'summer', 'winter']),
13-
('Diverging', ['BrBG', 'bwr', 'coolwarm', 'PiYG', 'PRGn', 'PuOr',
14-
'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn', 'Spectral',
15-
'seismic']),
16-
('Qualitative', ['Accent', 'Dark2', 'Paired', 'Pastel1',
17-
'Pastel2', 'Set1', 'Set2', 'Set3', 'tab10',
18-
'tab20', 'tab20b', 'tab20c']),
19-
('Miscellaneous', ['gist_earth', 'terrain', 'ocean', 'gist_stern',
20-
'brg', 'CMRmap', 'cubehelix',
21-
'gnuplot', 'gnuplot2', 'gist_ncar',
22-
'nipy_spectral', 'jet', 'rainbow',
23-
'gist_rainbow', 'hsv', 'flag', 'prism'])]
4+
cmaps = [('Perceptually Uniform Sequential', [
5+
'viridis', 'plasma', 'inferno', 'magma']),
6+
('Sequential', [
7+
'Greys', 'Purples', 'Blues', 'Greens', 'Oranges', 'Reds',
8+
'YlOrBr', 'YlOrRd', 'OrRd', 'PuRd', 'RdPu', 'BuPu',
9+
'GnBu', 'PuBu', 'YlGnBu', 'PuBuGn', 'BuGn', 'YlGn']),
10+
('Sequential (2)', [
11+
'binary', 'gist_yarg', 'gist_gray', 'gray', 'bone', 'pink',
12+
'spring', 'summer', 'autumn', 'winter', 'cool', 'Wistia',
13+
'hot', 'afmhot', 'gist_heat', 'copper']),
14+
('Diverging', [
15+
'PiYG', 'PRGn', 'BrBG', 'PuOr', 'RdGy', 'RdBu',
16+
'RdYlBu', 'RdYlGn', 'Spectral', 'coolwarm', 'bwr', 'seismic']),
17+
('Qualitative', [
18+
'Pastel1', 'Pastel2', 'Paired', 'Accent',
19+
'Dark2', 'Set1', 'Set2', 'Set3',
20+
'tab10', 'tab20', 'tab20b', 'tab20c']),
21+
('Miscellaneous', [
22+
'flag', 'prism', 'ocean', 'gist_earth', 'terrain', 'gist_stern',
23+
'gnuplot', 'gnuplot2', 'CMRmap', 'cubehelix', 'brg', 'hsv',
24+
'gist_rainbow', 'rainbow', 'jet', 'nipy_spectral', 'gist_ncar'])]

doc/users/plotting/colormaps/lightness.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717

1818
mpl.rcParams.update({'font.size': 12})
1919

20-
# Number of colormap par subplot for particular cmap categories
20+
# Number of colormap per subplot for particular cmap categories
2121
_DSUBS = {'Perceptually Uniform Sequential': 4, 'Sequential': 6,
22-
'Sequential (2)': 5, 'Diverging': 6, 'Qualitative': 4,
22+
'Sequential (2)': 6, 'Diverging': 6, 'Qualitative': 4,
2323
'Miscellaneous': 6}
2424

2525
# Spacing between the colormaps of a subplot
26-
_DC = {'Perceptually Uniform Sequential': 1.15, 'Sequential': 0.6,
27-
'Sequential (2)': 1.15, 'Diverging': 1.3, 'Qualitative': 1.3,
26+
_DC = {'Perceptually Uniform Sequential': 1.4, 'Sequential': 0.7,
27+
'Sequential (2)': 1.4, 'Diverging': 1.4, 'Qualitative': 1.4,
2828
'Miscellaneous': 1.4}
2929

3030
# Indices to step through colormap
@@ -35,7 +35,7 @@
3535

3636
# Do subplots so that colormaps have enough space.
3737
# Default is 5 colormaps per subplot.
38-
dsub = _DSUBS.get(cmap_category, 5)
38+
dsub = _DSUBS.get(cmap_category, 6)
3939
nsubplots = int(np.ceil(len(cmap_list) / float(dsub)))
4040

4141
# squeeze=False to handle similarly the case of a single subplot
@@ -67,15 +67,15 @@
6767
y_ = lab[0, :, 0]
6868
c_ = x
6969

70-
dc = _DC.get(cmap_category, 1.2) # cmaps horizontal spacing
70+
dc = _DC.get(cmap_category, 1.4) # cmaps horizontal spacing
7171
ax.scatter(x + j*dc, y_, c=c_, cmap=cmap, s=300, linewidths=0.0)
7272

7373
# Store locations for colormap labels
7474
if cmap_category in ('Perceptually Uniform Sequential',
75-
'Sequential', 'Sequential (2)'):
75+
'Sequential'):
7676
locs.append(x[-1] + j*dc)
7777
elif cmap_category in ('Diverging', 'Qualitative',
78-
'Miscellaneous'):
78+
'Miscellaneous', 'Sequential (2)'):
7979
locs.append(x[int(x.size/2.)] + j*dc)
8080

8181
# Set up the axis limits:

examples/color/colormaps_reference.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,27 @@
4242

4343
# Have colormaps separated into categories:
4444
# http://matplotlib.org/examples/color/colormaps_reference.html
45-
cmaps = [('Perceptually Uniform Sequential',
46-
['viridis', 'inferno', 'plasma', 'magma']),
47-
('Sequential', ['Blues', 'BuGn', 'BuPu',
48-
'GnBu', 'Greens', 'Greys', 'Oranges', 'OrRd',
49-
'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu',
50-
'Reds', 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd']),
51-
('Sequential (2)', ['afmhot', 'autumn', 'bone', 'cool',
52-
'copper', 'gist_heat', 'gray', 'hot', 'pink',
53-
'spring', 'Wistia', 'summer', 'winter']),
54-
('Diverging', ['BrBG', 'bwr', 'coolwarm', 'PiYG', 'PRGn', 'PuOr',
55-
'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn', 'Spectral',
56-
'seismic']),
57-
('Qualitative', ['Accent', 'Dark2', 'Paired', 'Pastel1',
58-
'Pastel2', 'Set1', 'Set2', 'Set3', 'tab10',
59-
'tab20', 'tab20b', 'tab20c']),
60-
('Miscellaneous', ['gist_earth', 'terrain', 'ocean', 'gist_stern',
61-
'brg', 'CMRmap', 'cubehelix',
62-
'gnuplot', 'gnuplot2', 'gist_ncar',
63-
'nipy_spectral', 'jet', 'rainbow',
64-
'gist_rainbow', 'hsv', 'flag', 'prism'])]
45+
cmaps = [('Perceptually Uniform Sequential', [
46+
'viridis', 'plasma', 'inferno', 'magma']),
47+
('Sequential', [
48+
'Greys', 'Purples', 'Blues', 'Greens', 'Oranges', 'Reds',
49+
'YlOrBr', 'YlOrRd', 'OrRd', 'PuRd', 'RdPu', 'BuPu',
50+
'GnBu', 'PuBu', 'YlGnBu', 'PuBuGn', 'BuGn', 'YlGn']),
51+
('Sequential (2)', [
52+
'binary', 'gist_yarg', 'gist_gray', 'gray', 'bone', 'pink',
53+
'spring', 'summer', 'autumn', 'winter', 'cool', 'Wistia',
54+
'hot', 'afmhot', 'gist_heat', 'copper']),
55+
('Diverging', [
56+
'PiYG', 'PRGn', 'BrBG', 'PuOr', 'RdGy', 'RdBu',
57+
'RdYlBu', 'RdYlGn', 'Spectral', 'coolwarm', 'bwr', 'seismic']),
58+
('Qualitative', [
59+
'Pastel1', 'Pastel2', 'Paired', 'Accent',
60+
'Dark2', 'Set1', 'Set2', 'Set3',
61+
'tab10', 'tab20', 'tab20b', 'tab20c']),
62+
('Miscellaneous', [
63+
'flag', 'prism', 'ocean', 'gist_earth', 'terrain', 'gist_stern',
64+
'gnuplot', 'gnuplot2', 'CMRmap', 'cubehelix', 'brg', 'hsv',
65+
'gist_rainbow', 'rainbow', 'jet', 'nipy_spectral', 'gist_ncar'])]
6566

6667

6768
nrows = max(len(cmap_list) for cmap_category, cmap_list in cmaps)

0 commit comments

Comments
 (0)