简体   繁体   中英

plt.show() display nothing

I don't undertstand why plt.show() display nothing

import matplotlib.pyplot as plt

plt.figure()
plt.imshow(image_np_with_detections)
plt.show()

I used plt.imsave("test2.png",image_np_with_detections) and it does save the picture that I would like to display on my screen using plt.show()

I already saw this answer which does not solve my issue , because I am using plt.show() only once.

What am I missing?

Try using plt.imread instead of plt.imsave. This worked for me

img = plt.imread(r"C:\temp\image.png")
plt.imshow(img)

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM