更改图例的边缘颜色和文本颜色

时间:2021-05-16 05:30:44

标签: python matplotlib geopandas

我正在尝试更改图例的边缘颜色和文本颜色(请参阅下面的输出)。

我正在使用 geopandas 来创建地理图。

fig, ax = plt.subplots(1, 1, figsize=(10,5))

divider = make_axes_locatable(ax)

cax = divider.append_axes("bottom", size="5%", pad=0.2)


merge.plot(ax=ax, column='Interest', cmap="Blues", legend=True, cax=cax, 
           legend_kwds={'label': "Interest by Country", "orientation": "horizontal"})



merge.boundary.plot(ax=ax, color="darkgray", linewidth=0.25)

ax.grid(False)
ax.axes.yaxis.set_visible(False)
ax.axes.xaxis.set_visible(False)
      
plt.show()

输出:

enter image description here

0 个答案:

没有答案