Black Lives Matter. Please consider donating to Black Girls Code today.

Legend positioning outside plot

I’m attempting to move my legend outside of my plot and noticed a discrepancy in the example from : https://plot.ly/javascript/legend/#positioning-the-legend-outside-the-plot And the reference material: https://plot.ly/javascript/reference/#layout-legend
The reference says only values between -2 and 3 are valid, but in the example uses x:100

I’ve tried a number of combinations including moving the xanchor, using values in -100 to 100 and still can’t seem to find what works.
Here’s my full legend object:
legend: {
orientation: ‘h’,
traceorder: ‘reversed’,
x: 0.1, // I’m editing this one
y: 1.2,
font: {
size: 10,
},
},

See examples below of what my plot is doing:

Here is my original plot (I’m trying to move the legend to the left so it doesn’t wrap): 27 AM
When I set my Lengend: x:-2 : 31 AM

Thanks for pointing this out. Settings like x: 100 are deprecated. We should update the example. If you’re interested, the deprecated syntax in converted in this block.

@etienne I think there may be a small bug (or it may be intended, not sure…)
If I have enough elements to make the legend wrap, it ignores the legend negative x value.
I have made two data arrays in the following example one commented out to quickly show you. Am I missing something?

That’s a bug. Thanks for the report!

You can subscribe to https://github.com/plotly/plotly.js/issues/2131 for the latest development info.

@bmarker I’m having the same issue at the moment. Did you find a solution to move the legend further left and to stop it wrapping?

Cheers

Jordan