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

Adjusting legend attributes

I just stated to move to Plotly from Matplotlib for generating journal quality figures. Plotly is very well organized so has many more advantages I believe!

But I can’t figure out legend issues like below,

  1. How can I align legend title to the center of legend box?

  2. What determines item size if I set 'layout.legend.itemsizing = “constant”?

  3. How can I adjust item size without changing data(e.g. line size or marker size)? I want to have smaller item sizes.

  4. Can I adjust margins or gaps between legend items?

Here’s the example figure. As you see, legend box goes out of the paper. So I want to know how to adjust legend attributes more detail.