I am making choropleth maps with geopandas. I want to draw maps with two layers of borders: thinner ones for national states (geopandas default), and thicker ones for various economic communities. Is this doable in geopandas?
Here is an example:
import geopandas as gpd
import numpy as np
import matplotlib.pyplot as plt
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
africa = world.query('continent == "Africa"')
EAC = ["KEN", "RWA", "TZA", "UGA", "BDI"]
africa["EAC"] = np.where(np.isin(africa["iso_a3"], EAC), 1, 0)
africa.plot(column="pop_est")
plt.show()
I have created a dummy variable for countries belonging to group EAC. I would like to draw a thicker border surrounding the countries in this group, while leaving the national borders in as well.
EDIT:
I still don't know how to make this work in subplots. Here is an example:
axs = ["ax1", "ax2"]
vars = ["pop_est", "gdp_md_est"]
fig, axs = plt.subplots(ncols=len(axs),
figsize=(10, 10),
sharex=True,
sharey=True,
constrained_layout=True)
for ax, var in zip(axs, vars):
africa.plot(ax=ax,
column=var,
edgecolor="black",
missing_kwds={
"color": "lightgrey",
"hatch": "///"
})
ax.set_title(var)
plt.show()
I wasn't able to apply Martin's solution directly.