我有一个随时间推移的每个国家的事件数据集,我想在事件发生的同一时间段内创建一个变化的热图。到目前为止,我已经:
ax2 = plt.axes(projection=ccrs.Miller())
ax2.set_global()
ax2.coastlines()
ax2.add_feature(cfeature.OCEAN, zorder=0)
ax2.add_feature(cfeature.BORDERS, linewidth=0.6)
ax2.set_title('Second axis plot')
grid_z0 = griddata(points, values, (x2d, y2d), method='cubic', fill_value=0)
print grid_z0
cnt = ax2.pcolormesh(lons_new, lats_new, grid_z0,
transform=ccrs.PlateCarree(), cmap = cmap, alpha = 0.5)
plt.show()
在哪里
x2d,y2d是:
lats_new = np.linspace(-90, 90, 91)
lons_new = np.linspace(-180, 180, 91)
x2d, y2d = np.meshgrid(lons_new, lats_new)
这将产生: first incident
我要实现的是:基于距离的插值(即我所附的图中的两个国家应该是分开的红色的,在边界处逐渐消失)。我尝试过scipy的一些插值方法,但似乎都做得不好(2d,以及griddata中的所有方法)。在
修正了使用高斯滤波器插值矩阵前轮廓:
图像作为事件值的二元矩阵(英国中的一个事件) 一个在阿根廷)。此处显示为彩色网格:
Color mesh before Guassian filter
对世界各地的掩模矩阵应用高斯滤波器:
其中grid_new是事件值的二维矩阵。使用guassian过滤器后的彩色网格: Matrix after guassian filter seen as a pcolormesh
相关问题 更多 >
编程相关推荐