错误:尝试重定位Geopandas图例时出现错误,没有标签`>>

问题描述 投票:0回答:1

只要不尝试更改图例的位置,我的图就可以正常工作。 (我正在绘制GeoDataFrame。)

# %%
ax = NE_shp.plot(column=NE_shp.iloc[:,4], figsize=(10,3), scheme='quantiles', edgecolor='k', k=10, legend=True)

#ax.legend(loc='upper left', bbox_to_anchor=(1, 1)) #This is the line for relocating legend

ax.set_title('The Map', fontsize=16)
ax.axis('off')

结果图:without legend position setting

但是当我使用现在被掩盖的行作为注释时,更改图例的位置,则会出现以下错误,并且图例未如下图所示

No handles with labels found to put in legend.

After setting a position for legend

((我怀疑它是否与scheme='quantiles'有关,因为它不是matplotlib固有的,而是由pySAL添加的。)

非常感谢您的建议。

只要不尝试更改图例的位置,我的图就可以正常工作。 (我正在绘制GeoDataFrame。)#%% ax = NE_shp.plot(column = NE_shp.iloc [:,4],figsize =(10,3),scheme ='quantiles',...

python matplotlib legend geopandas
1个回答
1
投票
GeoDataFrame.plot提供一个

GeoDataFrame.plot

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.