I would like to plot a map of the edges of the French departments, and the heat maps at the lower scale of the French IRIS. I read both shapefiles using GeoPandas.

And now

dep.plot(color="white", edgecolor='black')

enter image description here


iris.plot(column = 'ratio',cmap = 'Purples',ax=ax)

enter image description here

I would like to visualise the black edge colours of the departments on the IRIS plot, but when I try this

fig, ax = plt.subplots(figsize = (20,16)) 
df.plot(column = 'ratio',cmap = 'Purples',ax=ax)
dep.plot(color=None,edgecolor='k',linewidth = 4,ax=ax)

the first figure does not appear, and is hid by the second. I have tried to use alpha, to put the colour as None, but nothing seems to work.

Any help?

  • Can you try facecolor='none' in the second plot? – joris Oct 18 '18 at 13:25

I'm sure there is a better way (like setting transparent fill), but you can also use boundary method to return only the polygon outlines:

import geopandas as gpd
import matplotlib.pyplot as plt
df = gpd.read_file(r'E:\NUTS_2013_01M_SH\data\NUTS_RG_01M_2013.shp')

fig, ax = plt.subplots(figsize = (20,16)) 
df.plot(column = 'NUTS_ID',cmap = 'Purples',ax=ax)
df.geometry.boundary.plot(color=None,edgecolor='k',linewidth = 2,ax=ax) #Use your second dataframe

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.