Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Legend stretches the chart or even jumps above it - problem

Having a problem, that if I load too many traces into plotly chart, or these traces have too long names, the legend stretches the chart, as you can see on following image:

Or even the legend is jumping on the chart:

How can I deal with this? How can I tell the legend to stay still on it’s place? Or maybe there’s a method to specify the width and length or even the position of legend?

Try setting

layout.legend.x = 0 // corresponds to left edge of plot area
layout.legend.x = 1 // corresponds to right edge of plot area

layout.legend.y = 0 // corresponds to bottom of plot area
layout.legend.y = 1 // corresponds to top of plot area
1 Like

That’s not possible at the moment.


Our legend position is far from perfect at the moment. You might want to subscribe to https://github.com/plotly/plotly.js/issues/1199 for the latest development info.