I want to plot a list of images. However, the plots are too small, so I cannot see them well. I tried to increase the size but the output is not really what i wanted.
I know there are lot of examples out there, but they are mostly contain mostly overkill solutions.
plt.figure(figsize=(30, 100))
for img in images:
plt.subplots(n_img, 1, figsize=(8,10))
plt.imshow(im, 'gray')
plt.axis('off')
plt.tight_layout()
plt.show()
Thanks
Hard to say if this will help, but to avoid potential confusion with setting figsize
twice, I wouldn't call subplots
inside your loop. Instead I'd set up the figure and axes first, then plot to each axis in turn:
fig, axs = plt.subplots(n_img, 1, figsize=(8,10))
for img, ax in zip(images, axs):
ax.imshow(img, 'gray')
ax.axis('off')
plt.tight_layout()
plt.show()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.