【发布时间】:2023-03-26 12:15:01
【问题描述】:
我想逐行绘制 4000 张图像作为子图或使用其他方法。当我使用 subplot 方法时,显示的图像大小以某种方式减小。我想解决这个问题并了解导致绘图大小减小的原因,或者学习其他绘制图像的方法。
for ix in range(0, len(preds_train_t)):
fig = plt.figure()
#ix = random.randint(0, len(preds_train_t))
fig.add_subplot(ix+1, 3, 1)
plt.imshow(np.dstack((X_train[ix],X_train[ix],X_train[ix])))
tmp = np.squeeze(Y_train[ix]).astype(np.float32)
fig.add_subplot(ix+1, 3, 2)
plt.imshow(np.dstack((tmp,tmp,tmp)))
tmp = np.squeeze(preds_train_t[ix]).astype(np.float32)
fig.add_subplot(ix+1, 3, 3)
plt.imshow(np.dstack((tmp,tmp,tmp)))
plt.show()
Jupyter notebook 的结果:
【问题讨论】:
标签: python matplotlib jupyter-notebook