-3

Normally, I use following figure-closing pattern to prevent the error

%matplotlib inline

plt.figure()
// plot here what necessary
plt.show()
// figure is displayed inline
plt.close()

Replacing show with imshow, within for in loop only 1 last figure is displayed.

How to plot inline in loop with imshow, making sure that closing figures properly?

ludgo
  • 465
  • 1
  • 6
  • 13

1 Answers1

0

based on comment

for x in y:
    plt.figure()
    plt.imshow(...)
    plt.show()
    plt.close()
ludgo
  • 465
  • 1
  • 6
  • 13