Skip to content

Feature: legendgroup property should accept array to have multiple groups. #3076

@ievgennaida

Description

@ievgennaida

I would like to have legends grouped by a few criteria, ex: age, and gender.
Now it's possible to add a subgroups legend only by adding fake traces:

(comes from some plotly documentation)

fig.add_trace(go.Scatter(y=[None], mode='markers',
                         marker=dict(symbol='circle', color='black'),
                         name='Female',
                         ))

Only the gap that grouping is not working when legend is clicked from the frontend.
It would be possible to make it happened if the legendgroup property for each trace will accept an array.
In this case, it will be possible to still keep it clickable and resolve traces visibility.

Some related topics:
https://plotly.com/python/reference/#scatter-legendgroup
https://community.plotly.com/t/possible-to-have-nested-or-hierarchical-legends/2376/3
https://community.plotly.com/t/plotly-express-how-to-separate-symbol-and-color-in-legend/38950

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions