python – how to get the data from an plt.imshow()?

a should be a matplotlib.image.AxesImage instance, in which case you can use and The array is stored as a masked array. Example There’s an official example available at Direct access You can also use to access the array data directly, though I imagine that the getters and setters are the preferred method.