如何使用 matplotlib 在图像上绘制坐标数组?

How to plot array of coordinates on image using matplotlib?

我正在尝试使用 matplotlib 绘制坐标数组。 x & y 是两个具有 x 和 y 坐标的数组。
示例数据:

x = [489.99378204345703, 424.4607162475586, 665.4505157470703, 665.1176452636719]

y = [709.4012403488159, 253.38330745697021, 519.5582628250122, 519.5164632797241]

这是我用来绘图的代码

im = plt.imread(p_transform_path)
implot = plt.imshow(im)
for p,q in zip(x,y):
    x_cord = x[p]
    y_cord = y[q]
    plt.scatter([x_cord], [y_cord])
plt.show()

p_transform_path 是我绘制坐标的图像路径。

这是错误消息:

x_cord = x[p]
TypeError: list indices must be integers or slices, not numpy.float64
im = plt.imread(p_transform_path)
implot = plt.imshow(im)
for p,q in zip(x,y):
    x_cord = p # try this change (p and q are already the coordinates)
    y_cord = q
    plt.scatter([x_cord], [y_cord])
plt.show()