I’m plotting an image like this
fig, ax = plt.subplots()
ax.imshow(im, cmap = "gray")
I would like to draw a rectangle on top of the image with the following parameters (in image coordinates)
(0, 0, 240, 210)
(Top, left, width, height)
The docs for a rectangle patch says that the first parameter is a tuple specifying the “bottom left” of the rectangle.
rect = mpatches.Rectangle((0, 0 + 210), 240, 210, fill = False, linewidth = 2, edgecolor = randHex())
ax.add_patch(rect)
After plotting this, the rectangle shows up in the wrong place and I’m not sure why. I think there’s some kind of coordinate system mismatch between image coordinates which I’m using at the matplotlib’s coordinate system.
EDIT: If I just use (0, 0) it works fine, but that’s inconsistent with the docs.
