Let's take a simple example:
import plotly.express as px
x = ['A', 'B']
y = [10, 20]
fig = px.bar(x=x, y=y, color=x)
fig.update_layout(autosize=False, width=300, height=300, showlegend=True)
fig.show()
I set the width ad height to the same value, but get something rather different. I understand this is because of the space taken by the axes ticks and labels and the legend. So how do I set the size of the plotting area? Say I want a square plot. What should I do?
I tried adding:
fig.update_yaxes(
scaleanchor = "x",
scaleratio = 1,
)
but this didn't change the result. Any ideas?

