I’m trying to have the y and x axis for a scatterplot have the same scale when the graph is first displayed. However, upon zooming, I would like for the user to not be constrained to only fixed ratio zooms. Currently the scaleanchor attribute is great for the initial display but zooms are also fixed. What workarounds are there around this?
You’re right that that
scaleratio property is designed to constrain the zoom level as well. You should be able to set up the initial proportions using:
fig.layout.heightto set the overall figure width/height
b, properties of
fig.layout.marginto set the spacing between the outer edge of the plotting area and the outside of the figure.
fig.layout.yaxisto set the axis range extents.
So the aspect ratio of your plotting area (in screen coordinates) will be
(width - margin.l - margin.r)/(height - margin.t - margin.b)
Then you can set the ratio between the
yaxis.range to be some factor times this aspect ratio:
factor*(width - margin.l - margin.r)/(height - margin.t - margin.b)= (xaxis.range - xaxis.range)/(yaxis.range - yaxis.range)
Hope that helps get you started!
Hi @jmmease. Thanks for the detailed and quick response as usual. I look forward to trying this out, and will let you know how it turns out!