想法是在具有底图(r5_base)的图层中绘制,然后通过gpd覆盖'regionbybranch'。
从下面的图片可以看出,创建了两个图形,但我希望只有一个。所需的地图已与第二个图形正确绘制,但未遵循所需的“ figsize”
# Isolate Region on map
r5_base = bars[bars.Reg_Name=='REGION V (BICOL REGION)']
# Isolate region from OP data
region=mpabars_gdf[mpabars_gdf.RegionName=='Bicol Region']
# Plot area.
regionbybranch = region.dissolve(by='BranchName', aggfunc='sum',as_index=False)
fig, ax = plt.subplots(1,1,sharex=True, sharey= True, figsize=(30,30))
base = r5_base.plot(color='gray')
regionbybranch.plot(ax=base, linewidth=0.5, edgecolor='black', legend= False, column='Penetration',cmap='viridis')
# plt.title('Market Penetration on Bicol Region');
# fig.savefig(“map_export.png”, dpi=300)
我认为您在调用绘图功能时必须设置正确的轴名称。这样的事情应该起作用:
fig, ax = plt.subplots(1,1,sharex=True, sharey= True, figsize=(30,30))
base = r5_base.plot(ax=ax,color='gray')
regionbybranch.plot(ax=ax, linewidth=0.5, edgecolor='black',
legend= False, column='Penetration',cmap='viridis')