all, I use the such code to plot the images
import matplotlib.pyplot as plt
plt.imshow(array,cmap='jet')
plt.show()
however, now I want to get the handle (im
) of im=plt.imshow(array,cmap='jet')
How can I get the handle of im
if I ignore the handle in the second step.
You can call the method get_images()
on the ax
.
Example code:
ax = plt.gca()
ax.imshow(array)
ax.get_images() # returns a list of AxesImage objects if any.
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