-3

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

Henrik
  • 521
  • 3
  • 7
  • 16
  • 1
    When you say you tried to increase the size, what do you mean by "the output is not really what I wanted"? Please describe what you got, and how it differed from what you expected, along with how you got there. – Adam Barnes Feb 06 '18 at 11:53

1 Answers1

0

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()
Matt Hall
  • 7,614
  • 1
  • 23
  • 36