Skip to content

Commit

Permalink
Use new colourmap in documentation examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
QuLogic committed Apr 25, 2015
1 parent 6263df6 commit 8609d1a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
Expand Up @@ -25,7 +25,7 @@
# plot
plt.pcolor(np.arange(kxmin, kxmax + kstep * 1.1, kstep) - kstep / 2.,
np.arange(kymin, kymax + kstep * 1.1, kstep) - kstep / 2.,
transff.T)
transff.T, cmap='YlGnBu_r')

plt.colorbar()
plt.clim(vmin=0., vmax=1.)
Expand Down
Expand Up @@ -90,7 +90,7 @@
for i, lab in enumerate(labels):
ax = fig.add_subplot(4, 1, i + 1)
ax.scatter(out[:, 0], out[:, i + 1], c=out[:, 1], alpha=0.6,
edgecolors='none')
edgecolors='none', cmap='YlGnBu_r')
ax.set_ylabel(lab)
ax.set_xlim(out[0, 0], out[-1, 0])
ax.set_ylim(out[:, i + 1].min(), out[:, i + 1].max())
Expand Down
Expand Up @@ -86,7 +86,7 @@

# Plot

cmap = cm.hot_r
cmap = cm.YlGnBu_r

# make output human readable, adjust backazimuth to values between 0 and 360
t, rel_power, abs_power, baz, slow = out.T
Expand Down Expand Up @@ -127,6 +127,7 @@

# set slowness limits
ax.set_ylim(0, 3)
[i.set_color('grey') for i in ax.get_yticklabels()]
ColorbarBase(cax, cmap=cmap,
norm=Normalize(vmin=hist.min(), vmax=hist.max()))

Expand Down
Expand Up @@ -25,7 +25,7 @@
ax1.plot(t, tr.data, 'k')

img = ax2.imshow(np.abs(spec), extent=[t[0], t[-1], freq[-1], freq[0]],
aspect='auto', interpolation="nearest")
aspect='auto', interpolation='nearest', cmap='YlGnBu_r')
# Hackish way to overlay a logarithmic scale over a linearly scaled image.
twin_ax = ax2.twinx()
twin_ax.set_yscale('log')
Expand Down
Expand Up @@ -22,7 +22,7 @@
t,
np.logspace(np.log10(f_min), np.log10(f_max), scalogram.shape[0]))

ax.pcolormesh(x, y, np.abs(scalogram))
ax.pcolormesh(x, y, np.abs(scalogram), cmap='YlGnBu_r')
ax.set_xlabel("Time after %s [s]" % tr.stats.starttime)
ax.set_ylabel("Frequency [Hz]")
ax.set_yscale('log')
Expand Down
19 changes: 17 additions & 2 deletions misc/docs/source/tutorial/code_snippets/hierarchical_clustering.py
Expand Up @@ -13,15 +13,30 @@
dissimilarity = data['dissimilarity']

plt.subplot(121)
plt.imshow(1 - dissimilarity, interpolation="nearest")
plt.imshow(1 - dissimilarity, interpolation='nearest', cmap='YlGnBu_r')

dissimilarity = distance.squareform(dissimilarity)
threshold = 0.3
linkage = hierarchy.linkage(dissimilarity, method="single")
clusters = hierarchy.fcluster(linkage, threshold, criterion="distance")

# A little nicer set of colors.
cmap = plt.get_cmap('Paired', lut=6)
colors = ['#%02x%02x%02x' % tuple(col * 255 for col in cmap(i)[:3])
for i in range(6)]
try:
hierarchy.set_link_color_palette(colors[1:])
except AttributeError:
# Old version of SciPy
pass

plt.subplot(122)
hierarchy.dendrogram(linkage, color_threshold=0.3)
try:
hierarchy.dendrogram(linkage, color_threshold=0.3,
above_threshold_color=cmap(0))
except TypeError:
# Old version of SciPy
hierarchy.dendrogram(linkage, color_threshold=0.3)
plt.xlabel("Event number")
plt.ylabel("Dissimilarity")
plt.show()

0 comments on commit 8609d1a

Please sign in to comment.