Relocating legend from GeoPandas plot

josecoto picture josecoto · Oct 2, 2016 · Viewed 8.3k times · Source

I'm plotting a map with legends using the GeoPandas plotting function. When I plot, my legends appear in the upper right corner of the figure. Here is how it looks like: enter image description here

I wanted to move the legends to the lower part of the graph. I would normally would have done something like this for a normal matplotlib plot:

fig, ax = plt.subplots(1, figsize=(4.5,10))
lima_bank_num.plot(ax=ax, column='quant_cuts', cmap='Blues', alpha=1, legend=True)
ax.legend(loc='lower left')

However, this modification is not taken into account.

Answer

lincolnfrias picture lincolnfrias · Mar 28, 2019

This could be done using the legend_kwds argument:

df.plot(column='values', legend=True, legend_kwds={'loc': 'lower right'});