In ipython notebook, I am using matplotlib.pyplot imshow in a for loop like this:
for i in range(3):
plt.figure()
plt.imshow(I[i])
print("some explanation for image " + str(i))
Basically I hope to show each image followed by a print out sentence. But what I get is 3 sentences are printed out together, then followed with 3 images.
I tried to use time.sleep(1) before print() but does not work. Any idea to get the outputs of plt.imshow() and print() interleaving with each other?
Not what you asked for, but it will serve the same purpose:
for i in range(3):
plt.figure()
plt.imshow(I[i])
plt.title("some explanation for image " + str(i))

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With