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

Skip to content

Commit 1a8b76d

Browse files
committed
Merge pull request matplotlib#4203 from endolith/colormap_synonyms_in_examples
DOC : Colormap synonyms in examples, fix errors caused by removing duplicates
1 parent 3db86b6 commit 1a8b76d

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

doc/users/plotting/colormaps/lightness.py

Lines changed: 9 additions & 13 deletions
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
from skimage import color
@@ -47,10 +49,10 @@
4749

4850
# Do subplots so that colormaps have enough space. 5 per subplot?
4951
dsub = 5 # number of colormaps per subplot
50-
if cmap_category == 'Diverging': # because has 13 colormaps
52+
if cmap_category == 'Diverging': # because has 12 colormaps
53+
dsub = 6
54+
elif cmap_category == 'Sequential (2)':
5155
dsub = 6
52-
elif cmap_category == 'Sequential2':
53-
dsub = 7
5456
elif cmap_category == 'Sequential':
5557
dsub = 7
5658
nsubplots = int(np.ceil(len(cmap_list)/float(dsub)))
@@ -84,22 +86,16 @@
8486
ax.axis([-0.1,4.7,0,100])
8587
locs.append(x[-1]+j*dc) # store locations for colormap labels
8688

87-
elif cmap_category=='Sequential2':
89+
elif cmap_category=='Sequential (2)':
8890
dc = 1.15
8991
ax.scatter(x+j*dc, lab[0,:,0], c=x, cmap=cmap, s=300, linewidths=0.)
90-
if i==0:
91-
ax.axis([-0.1,8.1,0,100])
92-
else:
93-
ax.axis([-0.1,7.0,0,100])
92+
ax.axis([-0.1,7.0,0,100])
9493
locs.append(x[-1]+j*dc) # store locations for colormap labels
9594

9695
elif cmap_category=='Diverging':
9796
dc = 1.2
9897
ax.scatter(x+j*dc, lab[0,:,0], c=x, cmap=cmap, s=300, linewidths=0.)
99-
if i==0:
100-
ax.axis([-0.1,7.1,0,100])
101-
else:
102-
ax.axis([-0.1,6,0,100])
98+
ax.axis([-0.1,7.1,0,100])
10399
locs.append(x[int(x.size/2.)]+j*dc) # store locations for colormap labels
104100

105101
elif cmap_category=='Qualitative':

0 commit comments

Comments
 (0)