“m”是在https://www.dropbox.com/s/vua4nakd8sz3ocy/data.py?dl=0中定义的 GPS 坐标数组
我可以使用 matplotlib 函数
hist2d(zip(*m)[0],zip(*m)[1], bins=60, cmap='jet', normed=True)
生成正确的密度热图。
但是,如果我使用这种方式:
x,y = zip(*m)[:2]
heatmap, xedges, yedges = np.histogram2d(x,y,bins=50)
extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]]
clf()
scatter(x,y,c='k')
imshow(heatmap, extent=extent, cmap='jet')
它会产生明显错误的热图。为什么会这样?
黑点是 GPS 点。