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

Changing marging among legend items

Hi,

I am building a responsive site with Plotly js scatter graphs in it.

To make the graphs responsive, I call the reize and relayout methods on window resize. In relayout, I dynamically calculate font sizes and the graph margin each time to make it look good.

It all resizes nicely except the legend, which keeps a big distance between each of its items. I can’t find how to edit that in layout.

What’s the best way?

We don’t expose a way to do that at the moment, unfortunately. You might want to subscribe to https://github.com/plotly/plotly.js/issues/1668 for related development info.

Hi,

Thanks for the info!

Have a great day!