I am working on a Jupyter Notebook where I have a numpy.stack
of raster files with values between -1 and +1, which shape is as follows:
files.shape
(2, 766, 1398)
I am ploting one of them with:
plt.imshow(files[0], cmap="RdYlGn")
My objective is to ask the user to click somewhere in the image displayed with matplotlib
. When doing so, I want to store the array coordinates of the click event so that I can extract the pixel value at that location using:
values = files.sample(zip(Xc, Yc))
Looking for previous posts on this forum I found Store mouse click event coordinates with matplotlib but I am not managing to implement the proposed example.
Any help on this?