I want to display multiple images at once in one figure (i used a set of 22 images so for the subplot i used 5 rows and 5 columns) , but the problem is they display one by one every time i close the figure, here is how i did it :
import cv2
import glob
import matplotlib.pyplot as plt
path="data/*.jpg"
images=[cv2.imread(image) for image in glob.glob(path)]
fig=plt.figure()
for i in range(len(images)):
plt.subplot(5,5,i 1)
plt.imshow(images[i])
plt.show()
CodePudding user response:
The problem is you are displaying the plot within the loop, and should display it after you have placed all the images.
Move plt.show()
outside the loop.