在 GeoPandas 和 Matplotlib 中使用图层进行映射:问题是我无法设置所需的图大小

Mapping with Layers in GeoPandas and Matplotlib: Issue is I cannot set the desired fig size

想法是在具有底图(r5_base)的图层中绘制,然后通过 gpd a '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')