【发布时间】:2021-02-03 00:11:31
【问题描述】:
我正在根据该点的变量将地球上的点(经纬度坐标)分类。 我有一个数组(360 x 720)(地球的纬度、经度网格的分辨率),其中包含每个点的适当分类作为数字, 有13个类别;甲、乙、丙、... 在我的 360x 720 数组中,这些类别表示为 1、2、3、...、13。
我可以通过 cartopy 和 matplotlib 进行映射,但我一直在尝试制作一个图例/键来显示每种颜色映射代表的类别,我能得到的最好的结果是一个无用的颜色条。
ax = plt.axes(projection=ccrs.PlateCarree()) #cartopy
preplot = plt.contourf(lons, lats, Map, 17,
transform=ccrs.PlateCarree(), cmap = "tab20")
ax.coastlines() # cartopy
cb = plt.colorbar(preplot, orientation="horizontal")
plt.title("1901")
plt.show()
给出: enter image description here 地图和颜色条
对不起,如果这不是所有需要的信息
【问题讨论】:
标签: python matplotlib cartopy