# Group subplot scatter legends

**URL:** <https://community.plotly.com/t/group-subplot-scatter-legends/45436>\
**Category:** plotly.js\
**Created:** [September 28, 2020, 4:22pm UTC](https://community.plotly.com/t/group-subplot-scatter-legends/45436 "2020-09-28T16:22:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![emaringolo](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/emaringolo/32/5832_2.png) [@emaringolo](https://community.plotly.com/u/emaringolo)\
**Post date:** [September 28, 2020, 4:22pm UTC](https://community.plotly.com/t/group-subplot-scatter-legends/45436/1 "2020-09-28T16:22:22Z")

</div>

I have a multiplot (subplots) plot, with one or more scatter plots on each subplot axis.

 ![newplot (11)](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/0/009971388b55f14b89390e90849057d76024540c.png)

Is there a way to group these scatters into a single entry in the global legend?

Using a scattergroup doesn’t work, they’re toggled together but I need one one entry per group.

---

<div class="post-metadata">

**Author:** ![emaringolo](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/emaringolo/32/5832_2.png) [@emaringolo](https://community.plotly.com/u/emaringolo)\
**Post date:** [September 28, 2020, 6:01pm UTC](https://community.plotly.com/t/group-subplot-scatter-legends/45436/2 "2020-09-28T18:01:16Z")

</div>

My temporary workaround is to keep a global state and set the `showlegend: true` only to the first trace (of the same `legendgroup) and to `false` for traces afterwards.

---

<div class="post-metadata">

**Author:** ![emaringolo](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/emaringolo/32/5832_2.png) [@emaringolo](https://community.plotly.com/u/emaringolo)\
**Post date:** [September 28, 2020, 7:04pm UTC](https://community.plotly.com/t/group-subplot-scatter-legends/45436/3 "2020-09-28T19:04:45Z")

</div>

Also, is there a way to style the legendgroups so they look like regular legend entries? It is… without additional margin between each legend group.
