在地图上绘制图像

问题描述 投票:0回答:1

我想在底图上的特定坐标处放置一幅小图像,我需要做哪些修改

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

python matplotlib matplotlib-basemap
1个回答
0
投票

下面提供了您需要的相关代码段,希望对您有所帮助。

# ...
# 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()
© www.soinside.com 2019 - 2024. All rights reserved.