【发布时间】:2020-03-10 14:34:50
【问题描述】:
所以我有这个荷兰的 GADM 地理数据框,我想在荷兰的 GADM 上绘制不同颜色的阿姆斯特丹、乌得勒支、海牙和鹿特丹的叠加地图。但是,我无法更改叠加图的颜色。
这是我的尝试:
NL_boundaries = gpd.read_file("C:/Users/zaa_k/Documents/0.Thesis/Datasets/GADM/gadm36_NLD_2.shp")
NL_boundaries_Ams = NL_boundaries[NL_boundaries['NAME_2']=='Amsterdam']
NL_boundaries_Ams = NL_boundaries[NL_boundaries['NAME_2']=='Rotterdam']
NL_boundaries_Ut = NL_boundaries[NL_boundaries['NAME_2']=='Utrecht']
NL_boundaries_Hag = NL_boundaries[NL_boundaries['NAME_2']=="'s-Gravenhage"]
f, ax = plt.subplots(1, figsize=(12, 12))
ax = NL_boundaries.plot(axes=ax)
lims = plt.axis('equal')
for poly in NL_boundaries['geometry']:
gpd.plotting.plot_multipolygon(ax, poly, facecolor='red', linewidth=0.025)
for poly in NL_boundaries_Ams['geometry']:
gpd.plotting.plot_multipolygon(ax, poly, alpha=1, facecolor='red', linewidth=0)
for poly in NL_boundaries_Ut['geometry']:
gpd.plotting.plot_multipolygon(ax, poly, alpha=1, facecolor='red', linewidth=0)
for poly in NL_boundaries_Rot['geometry']:
gpd.plotting.plot_multipolygon(ax, poly, alpha=1, facecolor='red', linewidth=0)
for poly in NL_boundaries_Hag['geometry']:
gpd.plotting.plot_multipolygon(ax, poly, alpha=1, facecolor='red', linewidth=0)
ax.set_axis_off()
f.suptitle('Areas with smallest population')
plt.axis('equal')
plt.show()
谁能帮我把阿姆斯特丹、乌得勒支、海牙和鹿特丹染成其他颜色?谢谢
【问题讨论】:
-
如果我们可以访问数据,调试起来会更容易。能给个链接吗?
标签: python matplotlib