🏥 🏭 Working on the COVID-19 response in Canada? Plotly & the Canadian government can help you and your organization. Learn more and get in touch.

Plotly subplots with individual legends

I would like to display multiple subplots in one plot. Since the number of lines drawn are many, I would like to display the legend per subplot. The legend is currently displayed for all subplots (making reading the charts very cumbersome).

2 Likes

Unfortunately, plotly can only support one legend per graph at the moment.

I’d recommend using annotations instead.

1 Like

I have the same problem. Without the control on legends, large subplots become very complex to read, and the business users are confused with flying/ungrouped/wrongly-positioned legends :frowning: Control on legends will help in making the plots very intuitive and simple. Hope you will add this feature asap…

Here is my github issue for the same- https://github.com/ropensci/plotly/issues/826

Is there any new update on this issue?.

4 Likes

I have the same problem. Any update on this issue?

I used two side by side Div elements to emulate Plotly subplot . Doing this way, we have independent legends. However, if we want to share an axis, we should do it manually:

app.layout = html.Div(children=[
        html.Div(['YOUR FIRST GRAPH OBJECT'],
                 style = {'float':'left', 'width':'49%'}) ,
        html.Div(['YOUR SECOND GRAPH OBJECT'],
                 style = {'float':'right', 'width':'49%'})   
                ])

Is this possible now?

1 Like

So how do you zoom-in synchronously then?

Hello :slight_smile:
I have the same problem, and the same question then :sweat_smile: : “How can you manually set shared axis?”
Thanks

The otherwise good support for common zooming and panning of subplots is severely marred by the inability to display legends per subplot. I would be grateful if users here could comment on how they are getting around this.

Has anyone managed to get separate legends to show on each subplot?
Has anyone implemented common zooming and spanning across separate plots which are not subplots of a common figure?

Any suggestions of a better python interactive plotting library that can achieve this?

1 Like

Same issue as others in the group: The inability to display a legend for each subplot is unfortunate from a business perspective. For example, when displaying subplots with same colors the legend devolves and is difficult or impossible to interpret. One might simply alter the colors, but there are easily imagined cases where matching colors across subplots would be ideal to illustrate similar cohorts. Hope that this issue is addressed in a future release.

1 Like

Did you find a workaround? I am also stuck due to this missing feature :frowning: