0

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

1
  • Must specify the option column=''col1" in .plot().
    – swatchai
    Commented Nov 7, 2022 at 21:43

1 Answer 1

0

To plot/visualize a theme using values from a column of geodataframe you must add the option column="column_name" to the .plot() statement.

Swap color for cmap='rainbow'.

In your particular case,

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

should work.

enter image description here

1
  • 1
    I got a warning stating either column or color. I removed color and this worked :) Commented Nov 8, 2022 at 9:23

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