Wrong on polygons' color and legend

My geodataframe contains a column in which I store color of each polygon (as gdf[‘rgb’] ).
Then,I want to display each polygon with different color.

I did:

pol=gv.Polygons(gdf, vdims=['yas_tanim','rgb'] ,crs=ccrs.GOOGLE_MERCATOR ).opts(color='rgb',  width=800, height=800,show_legend=True,legend_position='right' , tools=['hover'])

But with this, I cannot display legend
What am I doing wrong in termes of coloring the polygons?


If you specify colors directly in a column it’ll simply apply those colors directly to each polygon and no actual color mapper is involved. If you want to generate a legend you should therefore point it to the column containing the categories you want to color by and then specify a cmap in the form of a dictionary mapping from the categories to the color for each category instead.

1 Like

Thank you,
I will try

I’ll try