【发布时间】:2016-03-31 05:18:08
【问题描述】:
我想使用 matplotlib 在图像背景上绘制图形。我在matlab中找到了如何做到这一点http://www.peteryu.ca/tutorials/matlab/plot_over_image_background
我尝试过类似这样的基本操作:
im = plt.imread("dd.png")
implot = plt.imshow(im)
theta=np.linspace(0,2*np.pi,50)
z=np.cos(theta)*39+145
t=np.sin(theta)*39+535-78+39
plt.plot(z,t)
plt.show()
但它给了我一些非常丑陋的东西:
【问题讨论】:
-
imshow可以接受更多参数,允许您指定图像的放置位置及其在坐标空间中的范围。默认情况下,左上角位于 (0, 0) 处,每个像素的宽高为 1x1 单位。
标签: image matplotlib background