def plot_colormeshmatrix_reduced(
X, Y, ymin = None, ymax = None,
title = "plot_colormeshmatrix_reduced"):
print "plot_colormeshmatrix_reduced X.shape", X.shape, "Y.shape", Y.shape
# input_cols = [i for i in df.columns if i.startswith("X")]
# output_cols = [i for i in df.columns if i.startswith("Y")]
# Xs = df[input_cols]
# Ys = df[output_cols]
# numsamples = df.shape[0]
# print "plot_scattermatrix_reduced: numsamples = %d" % numsamples
# # numplots = Xs.shape[1] * Ys.shape[1]
# # print "numplots = %d" % numplots
cbar_orientation = "vertical" # "horizontal"
gs = gridspec.GridSpec(Y.shape[2], X.shape[2]/2)
pl.ioff()
fig = pl.figure()
fig.suptitle(title)
# # alpha = 1.0 / np.power(numsamples, 1.0/(Xs.shape[1] - 0))
# alpha = 0.2
# print "alpha", alpha
# cols = ["k", "b", "r", "g", "c", "m", "y"]
for i in range(X.shape[2]/2):
for j in range(Y.shape[2]):
# print "i, j", i, j, Xs, Ys
ax = fig.add_subplot(gs[j, i])
pcm = ax.pcolormesh(X[:,:,i], X[:,:,X.shape[2]/2+i], Y[:,:,j], vmin = ymin, vmax = ymax)
# ax.plot(Xs.as_matrix()[:,i], Ys.as_matrix()[:,j], "ko", alpha = alpha)
ax.set_xlabel("goal")
ax.set_ylabel("error")
cbar = fig.colorbar(mappable = pcm, ax=ax, orientation=cbar_orientation)
ax.set_aspect(1)
if SAVEPLOTS:
fig.savefig("fig_%03d_colormeshmatrix_reduced.pdf" % (fig.number), dpi=300)
fig.show()
评论列表
文章目录