I have a dynamic size of plot in plotly, depending on number of bars:
I use such parametrization for legend position:
fig.update_layout(
bargap=0.1,
barmode='stack',
yaxis={
'side': 'right',
},
yaxis2={
'title': 'PSI',
'anchor': 'free',
'overlaying': 'y',
'side': 'left',
},
legend={
'x': 1.1,
},
**layout_params,
)
But there is a problem of different gaps between plot and legend while using different widths:
Is there any way to make fixed gap without relative calculation?