在地图上绘制图像

2024-03-29 13:35:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我想把一个小的图像放在一个特定坐标的底图上我需要做什么修改

def base_map(temp):
    fig = plt.figure(figsize=(360, 180), edgecolor='w')
    m = Basemap(projection='cyl', resolution='l',
                llcrnrlat=-90, urcrnrlat=90,
                llcrnrlon=-180, urcrnrlon=180, )
    draw_map(m)

    m.bluemarble()

    plt.show()

这是我要做的最后一个结果https://i.stack.imgur.com/XHLF6.jpg


Tags: 图像mapbasedeffigplttempfigure
1条回答
网友
1楼 · 发布于 2024-03-29 13:35:45

下面给出了您需要的相关代码片段,希望对您有所帮助

# ...
# other lines of code go above

filename = "some_image.png"
lonmin, lonmax, latmin, latmax = (100.6377, 100.6447, 13.729, 13.7325) # just example
image_extent = (lonmin, lonmax, latmin, latmax)
ax = plt.gca()
ax.imshow(plt.imread(filename), extent=image_extent)
plt.show()

相关问题 更多 >