GeoPandas | Legend not showing

geopandaslegendplotpython

Goal: Show legend

I've set legend=True and no difference was made.

for i in list(range(NUM_SLIDES)):
    d = {'col1': ['Foo', 'Bar', 'Sue'], 'geometry': [foo[i], bar[i], sue[i]]}
    gdf = gpd.GeoDataFrame(d, crs='EPSG:4326').plot(legend=True, alpha=0.5, color=list(mcolors.BASE_COLORS.values()), aspect=1);

First Plot:

enter image description here

Best Answer

gdf = gpd.GeoDataFrame(d, crs='EPSG:4326').plot(column='col1', legend=True, cmap='rainbow', alpha=0.5, aspect=1);

Swap color for cmap='rainbow'.

enter image description here

Source