Plotly, same scale for x and y axis
You can assign same length for height and width in your layout. Here is an example:
layout = Layout(
xaxis=XAxis(
range=[-150, 150],
showgrid=True,
zeroline=True,
showline=True,
gridcolor='#bdbdbd',
gridwidth=2,
zerolinecolor='#969696',
zerolinewidth=4,
linecolor='#636363',
linewidth=6
),
yaxis=YAxis(
range=[-150,150],
showgrid=True,
zeroline=True,
showline=True,
gridcolor='#bdbdbd',
gridwidth=2,
zerolinecolor='#969696',
zerolinewidth=4,
linecolor='#636363',
linewidth=6
),
height=600,
width=600,
)
Finally, this feature is implemented.
layout = go.Layout(yaxis=dict(scaleanchor="x", scaleratio=1))
Update: in new versions of plotly, use the following:
fig.update_yaxes(
scaleanchor = "x",
scaleratio = 1,
)
See example here https://plot.ly/python/axes/#fixed-ratio-axes.