8000 Merge pull request #3458 from tacaswell/colormap_fix · matplotlib/matplotlib@a002be6 · GitHub
[go: up one dir, main page]

Skip to content

Commit a002be6

Browse files
committed
Merge pull request #3458 from tacaswell/colormap_fix
DOC : minor import tweaks
2 parents 0eaedc8 + 8247c2d commit a002be6

File tree

3 files changed

+14
-21
lines changed

3 files changed

+14
-21
lines changed

doc/users/plotting/colormaps/Lfunction.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
'''
2-
Recreate Josef Albers plot illustrating the Weber-Fechner law and illustrate
3-
with the binary matplotlib colormap, too. Trying to show the difference between
2+
Recreate Josef Albers plot illustrating the Weber-Fechner law and illustrate
3+
with the binary matplotlib colormap, too. Trying to show the difference between
44
adding blackness to a color at different rates.
55
'''
66

77
import numpy as np
88
import matplotlib.pyplot as plt
9-
from skimage import io, color
10-
import pdb
9+
from skimage import color
1110
import matplotlib as mpl
12-
from mpl_toolkits.mplot3d import Axes3D
13-
from matplotlib import cm, colors
11+
from matplotlib import cm
1412

1513

1614
mpl.rcParams.update({'font.size': 20})
@@ -90,7 +88,7 @@
9088

9189

9290
# common ylabel
93-
ax1.text(-0.3, 3.8, 'Additional Parts Black',
91+
ax1.text(-0.3, 3.8, 'Additional Parts Black',
9492
rotation=90, transform=ax1.transAxes)
9593

9694

@@ -164,7 +162,7 @@
164162
ax2.spines['left'].set_visible(False)
165163

166164
# common ylabel
167-
ax1.text(-0.3, 4.0, 'Steps through map indices',
165+
ax1.text(-0.3, 4.0, 'Steps through map indices',
168166
rotation=90, transform=ax1.transAxes)
169167

170168
fig.subplots_adjust(hspace=0.0)

doc/users/plotting/colormaps/grayscale.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
Uses lightness L* as a proxy for grayscale value.
44
'''
55

6-
from skimage import io, color
6+
from skimage import color
77
import numpy as np
88
import matplotlib.pyplot as plt
99
from matplotlib import cm
1010
import matplotlib as mpl
11-
import pdb
12-
from scipy.optimize import curve_fit
1311

1412
mpl.rcParams.update({'font.size': 14})
1513
mpl.rcParams['font.sans-serif'] = 'Arev Sans, Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Helvetica, Avant Garde, sans-serif'
@@ -40,7 +38,7 @@
4038
'gnuplot', 'gnuplot2', 'ocean', 'rainbow',
4139
'terrain', 'flag', 'prism'])]
4240

43-
# indices to step through colormap
41+
# indices to step through colormap
4442
x = np.linspace(0.0, 1.0, 100)
4543

4644
nrows = max(len(cmap_list) for cmap_category, cmap_list in cmaps)
@@ -78,4 +76,3 @@ def plot_color_gradients(cmap_category, cmap_list):
7876
for cmap_category, cmap_list in cmaps:
7977

8078
plot_color_gradients(cmap_category, cmap_list)
81-

doc/users/plotting/colormaps/lightness.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
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.
33
'''
44

5-
from skimage import io, color
5+
from skimage import color
66
import numpy as np
77
import matplotlib.pyplot as plt
88
from matplotlib import cm
99
import matplotlib as mpl
10-
import pdb
11-
from scipy.optimize import curve_fit
1210

1311
mpl.rcParams.update({'font.size': 14})
1412
mpl.rcParams['font.sans-serif'] = 'Arev Sans, Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Helvetica, Avant Garde, sans-serif'
@@ -39,7 +37,7 @@
3937
'gnuplot', 'gnuplot2', 'ocean', 'rainbow',
4038
'terrain', 'flag', 'prism'])]
4139

42-
# indices to step through colormap
40+
# indices to step through colormap
4341
x = np.linspace(0.0, 1.0, 100)
4442

4543
# Do plot
@@ -49,9 +47,9 @@
4947
dsub = 5 # number of colormaps per subplot
5048
if cmap_category == 'Diverging': # because has 13 colormaps
5149
dsub = 6
52-
elif cmap_category == 'Sequential2':
50+
elif cmap_category == 'Sequential2':
5351
dsub = 7
54-
elif cmap_category == 'Sequential':
52+
elif cmap_category == 'Sequential':
5553
dsub = 7
5654
nsubplots = int(np.ceil(len(cmap_list)/float(dsub)))
5755

@@ -63,7 +61,7 @@
6361

6462
ax = fig.add_subplot(nsubplots, 1, i+1)
6563
# pdb.set_trace()
66-
64+
6765
for j, cmap in enumerate(cmap_list[i*dsub:(i+1)*dsub]):
6866

6967
# Get rgb values for colormap
@@ -113,7 +111,7 @@
113111
ax.scatter(x+j*dc, lab[0,:,0], c=x, cmap=cmap, s=300, linewidths=0.)
114112
ax.axis([-0.1,6.1,0,100])
115113
locs.append(x[int(x.size/2.)]+j*dc) # store locations for colormap labels
116-
114+
117115
# Set up labels for colormaps
118116
ax.xaxis.set_ticks_position('top')
119117
ticker = mpl.ticker.FixedLocator(locs)

0 commit comments

Comments
 (0)
0