def plot_alpha(alpha, x, y):
f, (a0, a1) = plt.subplots(2)
gs = grd.GridSpec(2,1, wspace=0.01) #, height_ratios=[1, 4])
a0 = plt.subplot(gs[0])
a0.matshow(x.T, cmap=plt.cm.Greys_r) #, aspect='auto')
probs = np.zeros_like(alpha)
for i in range(len(alpha)):
probs[i] = np.convolve(
alpha[i], np.ones((2,))/2., mode='same')
a1.matshow(alpha, interpolation='none', aspect='auto')
xticks = np.argmax(probs, axis=1)
a1.set_xticks(xticks)
a1.set_xticklabels(y, fontsize=16)
a1.grid(which='both')
plt.subplots_adjust(top=None, bottom=None, wspace=0.05, hspace=0.05)
plt.show()
评论列表
文章目录