Offline heat map with map background

試著忘記壹切 提交于 2019-12-20 04:21:31

问题


I am trying to find if we can have background set (as 2D map) for a heat map ? Read data from a file and plot heat map (which is pretty simple) But in offline mode can we have the heat map imposed on the real map ?

Any useful suggestion appreciated.


回答1:


You use a heat map as the background for a geographical map (which I think is what you are asking about) using basemap and imshow.

from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np

m = Basemap(width=12000000,height=9000000,projection='lcc',
            resolution='c',lat_1=45.,lat_2=55,lat_0=50,lon_0=-107.)
m.drawcoastlines(linewidth=0.25)

data = 100*np.random.rand(10,10)
m.imshow(data, interpolation = 'none')

plt.show()



来源:https://stackoverflow.com/questions/30163952/offline-heat-map-with-map-background

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!