# Legend conflicts with multiple polygon layers

**URL:** <https://discourse.holoviz.org/t/legend-conflicts-with-multiple-polygon-layers/4669>\
**Category:** GeoViews\
**Tags:** bokeh\
**Created:** [December 5, 2022, 11:50am UTC](https://discourse.holoviz.org/t/legend-conflicts-with-multiple-polygon-layers/4669 "2022-12-05T11:50:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anitagraser](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/anitagraser/32/158_2.png) [@anitagraser](https://discourse.holoviz.org/u/anitagraser)\
**Post date:** [December 5, 2022, 11:50am UTC](https://discourse.holoviz.org/t/legend-conflicts-with-multiple-polygon-layers/4669/1 "2022-12-05T11:50:09Z")

</div>

I have two polygon GeoDataFrames that I want to show on the same map plot. Both should be rendered according to a categorical column and cmap. If I try to do this, I get only one legend (for the first layer) and the colors are broken (all white):

```auto
map1 = gdf1.hvplot(geo=True, c='class1', cmap={'A': 'blue', 'B': 'green', 'S': 'red', 'none': 'gray'}, alpha=0.5, tiles='OSM')
map2 = gdf2.hvplot(geo=True, c='class2', cmap={'abc':'white', 'def':'gray'})
map1 * map2

```

![image](https://discourse.holoviz.org/uploads/default/original/2X/0/0d38d8b8dcfc8805a8799d59b97ab403f61da4e4.png)

I can partially fix this by deactivating the legend for the second layer. Then the colors of the first layer legend items are displayed correctly:

```auto
map1 = gdf1.hvplot(geo=True, c='class1', cmap={'A': 'blue', 'B': 'green', 'S': 'red', 'none': 'gray'}, alpha=0.5, tiles='OSM')
map2 = gdf2.hvplot(geo=True, c='class2', cmap={'abc':'white', 'def':'gray'}, legend=False)
map1 * map2

```

![image](https://discourse.holoviz.org/uploads/default/original/2X/4/4a6cf39f1b8232d00da1c7f1a7c05659daf9ba85.png)

Am I missing something? Is it possible to get the legends of both layers display corrrectly?

```auto
geopandas : 0.10.2
holoviews : 1.14.9
hvplot : 0.8.0
geoviews : 1.9.5
bokeh : 2.4.3

```

---

<div class="post-metadata">

**Author:** ![carl](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/carl/32/5215_2.png) [@carl](https://discourse.holoviz.org/u/carl)\
**Post date:** [December 5, 2022, 4:42pm UTC](https://discourse.holoviz.org/t/legend-conflicts-with-multiple-polygon-layers/4669/2 "2022-12-05T16:42:22Z")

</div>

Hi @anitagraser,

I saw this and wonder if your hitting similar issue here seems like similar kind of problem

[https://github.com/holoviz/holoviews/issues/5305](https://github.com/holoviz/holoviews/issues/5305)

---

<div class="post-metadata">

**Author:** ![anitagraser](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/anitagraser/32/158_2.png) [@anitagraser](https://discourse.holoviz.org/u/anitagraser)\
**Post date:** [December 6, 2022, 11:22am UTC](https://discourse.holoviz.org/t/legend-conflicts-with-multiple-polygon-layers/4669/3 "2022-12-06T11:22:25Z")

</div>

Thank you, @carl. That indeed sounds like my issue. I’ll leave a comment there.
