Gabriel
Gabriel

Reputation: 42389

Display x,y coordinates for loaded image file

I need to load an image file with matplotlib and see the coordinates of points within it, as if it were a simple x,y scatter plot.

enter image description here

I can assume that the x axis extension is [0, 1], and the y axis follows the same scaling. I can load the above image file with

from PIL import Image
im = Image.open("del.png")
im.show()

but this uses ImageMagick (I'm on a Linux system) to display the image, and no coordinates are shown in the bottom left part of the plot window as would for a simple data plot:

enter image description here

Upvotes: 1

Views: 2459

Answers (1)

fernandezcuesta
fernandezcuesta

Reputation: 2448

Use pyplot for that:

from matplotlib import pyplot as plt
plt.imshow(plt.imread('del.png'))

Upvotes: 2

Related Questions