使用 Geopandas 绘制具有离散 colorbar/legend 的等值线图

Plotting choropleth map with discrete colorbar/legend using Geopandas

我正在尝试使用 Geopandas 制作等值线图。但是我在 colourbar 格式方面遇到了问题,它似乎非常有限。

这是我的地图:

但我希望颜色条(图例?)是不连续的中断,或者颜色键,我不太确定该怎么称呼它。像这样:

Geopandas 甚至可以做到这一点吗?我在他们的文档中找不到任何内容。也许 legend_kwds?

这是我的绘图代码

fig, ax = plt.subplots(1, figsize = (20, 12) )

ax.axis('off')

merged.plot(ax = ax, column = '2019-12', color = 'grey', label = 'No Data') #Plots 'No Data' layer
merged.dropna().plot(ax = ax, column = '2019-12', cmap = 'Reds', alpha = 1, legend = True) #Plots data layer

ax.legend()

在理想情况下,我还可以手动设置间隔的数量和限制。

帮了大忙。我能够使用 classification_kwds 并在调用 gpd.plot() 时使用 User_Defined scheme 参数定义我自己的容器。虽然我想要更多的功能,但现在已经足够了。