I have a plot with multiple images. There are 20 rows and 3 columns. In each row the 1st column should be the original image, the 2nd column should be the mask and the 3rd column should be segmentation obtained using a neural network.
I tried using the below code. 2 rows can be plotted correctly. From 3rd row images overlap the 1st row.
f = plt.figure()
for j in range(3):
pred_y = y_pred[j]
pred_y = pred_y.reshape(256, 256)
pred_y = (pred_y > 0.1).astype(np.uint8)
f.add_subplot(j + 1, 3, 1 )
plt.imshow(X_test[j, :, :])
f.add_subplot(j + 1, 3, 2)
plt.imshow(y_test[j])
f.add_subplot(j + 1, 3, 3)
plt.imshow(pred_y)
plt.show()
The obtained output is,

np.ones((256, 256), 'uint8')or a random array instead of the images.