0

I am trying to review a list of images in Matplotlib. However, I found that plt.close() does not close the current plot, and I need to manually do close the window. How can I resolve this?

import matplotlib.pyplot as plt
from PIL import Image

for imgpath in imgpth_list:
    show_image(imgpath)
    image = Image.open(imgpath)
        title = imgpath.split("/")[-1]
        plt.imshow(image)
        plt.title(title)
        plt.axis('off')
        plt.show()
        _ = input("Press [enter] to continue.")
        plt.close()
2
  • 1
    Is your problem similar to this? Non-blocking behaviour of matplotlib is often fickle and depends on matplotlib version, backend, and OS. Commented Oct 24, 2020 at 8:58
  • 1
    oh, yes~ it works now thanks! Commented Oct 25, 2020 at 9:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.