Issue
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:
Solution
To plot/visualize a theme
using values from a column of geodataframe you must add the option column="column_name" to the .plot()
statement.
In your particular case,
gdf = gpd.GeoDataFrame(d, crs='EPSG:4326').plot(column= "col1", legend=True, alpha=0.5, color=list(mcolors.BASE_COLORS.values()), aspect=1);
should work.
Answered By - swatchai
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.