假设我正在以图像为背景绘制一组点。我在示例中使用了Lena图像:
import numpy as np
import matplotlib.pyplot as plt
from scipy.misc import imread
np.random.seed(0)
x = np.random.uniform(0.0,10.0,15)
y = np.random.uniform(0.0,10.0,15)
img = imread("lena.jpg")
plt.scatter(x,y,zorder=1)
plt.imshow(img,zorder=0)
plt.show()
这给了我
我的问题是:如何在绘图中指定图像的角坐标?假设我希望左下角在x, y = 0.5, 1.0
,右上角在x, y = 8.0, 7.0
使用
imshow
的extent
关键字。参数的顺序是[left, right, bottom, top]
.imshow
然后.scatter
)并更改extent
值李>必须使用
extent
关键字参数:区段的元素应以数据单位指定,以便图像可以与数据匹配。例如,这可用于将地理路径(坐标阵列)覆盖在地理参考地图图像上
相关问题 更多 >
编程相关推荐