Adjust legend spacing

How can I reduce the space in between the legend traces:

legend

I tried all parameters specified here: https://plotly.com/python/reference/layout/#layout-showlegend

No luck. Same applies for horizontal layout.

Hi there,
Try adjusting the tracegroupgap

fig.update_layout(legend_tracegroupgap=5)

Default value is 10

1 Like

this doesn’t work if legends are same group.