问题
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