Skip to content

Commit a3ed3ab

Browse files
committed
more examples of using sequential colormaps for non-negative data, diverging colormaps for bipolar data
1 parent fccaa18 commit a3ed3ab

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

examples/pylab_examples/colorbar_tick_labelling_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
data = np.clip(randn(250, 250), -1, 1)
1616

17-
cax = ax.imshow(data, interpolation='nearest')
17+
cax = ax.imshow(data, interpolation='nearest', cmap=cm.coolwarm)
1818
ax.set_title('Gaussian noise with vertical colorbar')
1919

2020
# Add colorbar, make sure to specify tick locations to match desired ticklabels
@@ -27,7 +27,7 @@
2727

2828
data = np.clip(randn(250, 250), -1, 1)
2929

30-
cax = ax.imshow(data, interpolation='nearest')
30+
cax = ax.imshow(data, interpolation='nearest', cmap=cm.afmhot)
3131
ax.set_title('Gaussian noise with horizontal colorbar')
3232

3333
cbar = fig.colorbar(cax, ticks=[-1, 0, 1], orientation='horizontal')

examples/pylab_examples/image_nonuniform.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
fig = figure()
2020
fig.suptitle('NonUniformImage class')
2121
ax = fig.add_subplot(221)
22-
im = NonUniformImage(ax, interpolation=interp, extent=(-4,4,-4,4))
22+
im = NonUniformImage(ax, interpolation=interp, extent=(-4,4,-4,4), cmap=cm.Purples)
2323
im.set_data(x, y, z)
2424
ax.images.append(im)
2525
ax.set_xlim(-4,4)
2626
ax.set_ylim(-4,4)
2727
ax.set_title(interp)
2828

2929
ax = fig.add_subplot(222)
30-
im = NonUniformImage(ax, interpolation=interp, extent=(-64,64,-4,4))
30+
im = NonUniformImage(ax, interpolation=interp, extent=(-64,64,-4,4), cmap=cm.Purples)
3131
im.set_data(x2, y, z)
3232
ax.images.append(im)
3333
ax.set_xlim(-64,64)
@@ -37,15 +37,15 @@
3737
interp = 'bilinear'
3838

3939
ax = fig.add_subplot(223)
40-
im = NonUniformImage(ax, interpolation=interp, extent=(-4,4,-4,4))
40+
im = NonUniformImage(ax, interpolation=interp, extent=(-4,4,-4,4), cmap=cm.Purples)
4141
im.set_data(x, y, z)
4242
ax.images.append(im)
4343
ax.set_xlim(-4,4)
4444
ax.set_ylim(-4,4)
4545
ax.set_title(interp)
4646

4747
ax = fig.add_subplot(224)
48-
im = NonUniformImage(ax, interpolation=interp, extent=(-64,64,-4,4))
48+
im = NonUniformImage(ax, interpolation=interp, extent=(-64,64,-4,4), cmap=cm.Purples)
4949
im.set_data(x2, y, z)
5050
ax.images.append(im)
5151
ax.set_xlim(-64,64)

examples/pylab_examples/mri_with_eeg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
if 1: # plot the MRI in pcolor
2424
subplot(221)
25-
imshow(im, cmap=cm.jet)
25+
imshow(im, cmap=cm.gray)
2626
axis('off')
2727

2828
if 1: # plot the histogram of MRI intensity

examples/pylab_examples/pcolor_log.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
Z1 = bivariate_normal(X, Y, 0.1, 0.2, 1.0, 1.0) + 0.1*bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
1616

1717
subplot(2,1,1)
18-
pcolor(X, Y, Z1, norm=LogNorm(vmin=Z1.min(), vmax=Z1.max()))
18+
pcolor(X, Y, Z1, norm=LogNorm(vmin=Z1.min(), vmax=Z1.max()), cmap=cm.PuBu_r)
1919
colorbar()
2020

2121
subplot(2,1,2)
22-
pcolor(X, Y, Z1)
22+
pcolor(X, Y, Z1, cmap=cm.PuBu_r)
2323
colorbar()
2424

2525

examples/pylab_examples/specgram_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@
2525
ax1 = subplot(211)
2626
plot(t, x)
2727
subplot(212, sharex=ax1)
28-
Pxx, freqs, bins, im = specgram(x, NFFT=NFFT, Fs=Fs, noverlap=900)
28+
Pxx, freqs, bins, im = specgram(x, NFFT=NFFT, Fs=Fs, noverlap=900, cmap=cm.gist_heat)
2929
show()

examples/pylab_examples/subplots_adjust.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33

44
subplot(211)
5-
imshow(rand(100,100))
5+
imshow(rand(100,100), cmap=cm.BuPu_r)
66
subplot(212)
7-
imshow(rand(100,100))
7+
imshow(rand(100,100), cmap=cm.BuPu_r)
88

99
subplots_adjust(bottom=0.1, right=0.8, top=0.9)
1010
cax = axes([0.85, 0.1, 0.075, 0.8])

0 commit comments

Comments
 (0)