'Scaling axes properly in plotly 3D
I'm using plotly to plot a 3D rectangle with sides x = 27, y = 27, z = 214. Here's the current picture and my code. But I want the box to be rectangular and to scale. Ie, I dont want the axes to be a cube. The z direction of the plot should be long. I also want it flipped so that the z direction is sideways, is this possible too? plotly is very poorly documented
import plotly.graph_objects as go
fig = go.Figure()
fig.data = []
#Plot the rectangle by scaling a cube with the right vertices
x=np.array([0, 0, 1, 1, 0, 0, 1, 1])*27
y=np.array([0, 1, 1, 0, 0, 1, 1, 0])*27
z=np.array([0, 0, 0, 0, 1, 1, 1, 1])*214
box = go.Scatter3d(
x=x,
y=y,
z=z,
mode='lines',
name='overall box',
line=dict(color= 'rgb(0,255,0)', width=1))
fig.add_trace(box)
Solution 1:[1]
nvm figured it out. Need to add this:
self.fig.update_layout(scene = dict( aspectmode='data'))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Seth Peters |

