I'm pretty new to Python (and really new to using MatPlotLib and imageio), and I was wondering if there was a possibility to first plot an image and then print some text.
What I mean: when you give:
print('Test')
plt.imshow(imageio.imread(<location>))
It first prints the text and then the image, but when you give:
plt.imshow(imageio.imread(<location>))
print('Test')
It still prints the text first.
Is there a solution to this? And if not, is there an alternative way to do this?
Use plt.show()
after imshow
import matplotlib.pylab as plt
from numpy import random
Z = random.random((20,20)) # Test data
plt.imshow(Z, cmap=plt.get_cmap("Spectral"), interpolation='nearest') # Test plot
plt.show()
print("test")
The result:
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