Plotly Express: Legend inside figure



I wonder if it is possible to bring the legend inside a figure. I have a callback where a figure is created and send via callback to a dcc.Graph. I tried figure.update(layout…legnd:{}). But the legend is still outside.

Best regards!


It’s definitely possible to move the legend wherever you’d like with .update(). Can you share a more complete example of the code that’s not working for you?