Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Keeping Graph Scales Constant

I am making a 3D scatter plot that is supposed to shift according to a separate time variable. However, Plotly automatically rescales the graph whenever the data in it changes, resulting in no discernible difference in the graph except that the scales are changing. Is there any way to turn off this feature?
I have already tried setting yaxis.autorerange to false and manually setting the scale, but it didn’t seem to change this behavior in any way.

Try setting layout.scene.yaxis.range: [0, 1] or some other [a, b] range.

Setting layout.scene.yaxis.range only seems to limit what points are graphed, rather than directly adjusting the graphing space. The scales are then limited to maximize the points that are within that range. I want to be able to have a bunch of blank space to one side of the graph, if necessary.

Oh. You’re looking for scene.aspectratio then.

I think that’s closer to what I’m looking for, but not quite. Here is what happens when I set scene.aspectratio.y to 0.5:

What I want is some way to shift the data over to one side like that, but while keeping the graphing space cube-shaped, so that there would be a portion of the graphing space that is marked, but that has no data in it.

I’ve figured out a good enough solution. I’m going to document it here in case anyone in the future deals with the same problem.

I made a second trace that contains two points, one having the desired minimum values, the other with the desired maximum value. I then set div.layout.scene.xaxis = {range: [xmin, xmax]}, and again for the other two axes. There are probably other ways that don’t overwrite anything else that is defined on the axis, but this seemed to be the only way that works. I then set the size of the markers in the new trace to 1px with hoverinfo set to “skip”. That way, the new trace is almost unnoticeable, while still being able to stretch the graph according to my desires.