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 Add legend 'auto' x|y and/or 'container' (x|y)ref · Issue #1199 · plotly/plotly.js · GitHub for the latest development info.