Can Dash help to put legends on top of each subplot?

For example, I create two subplots with plotly. Each subplot has one trace. Two traces and two legends in total. Plotly can only support to put the two legends together on top or bottom or other area which I can select. But what I want is to put corresponding legends on the top of its subplot (in my example, I want one legend on top of one subplot and another legend on another subplot). I was advised that plotly cannot support this layout. Can anyone advise me whether or not Dash can help me out? And how to make it? Thanks!

Hi @alexcj, you can emulate plotly subplots with Dash by having two dcc.Graph side by side, each with their own legend and controllable legend position. You probably want to include each a dcc.Graph within its own html.Div so that you can control better its position. I confirm that plotly subplots cannot have independent legends.

1 Like

hi, @Emmanuelle, thank you for the clues! Is it possible that you share with me an example of similar code? That will be very much appreciated!