0

I'm trying to plot some points with the scatter_3d function but the plot get "elongated" along the z axis for some reason:

enter image description here

Is there a way to fix it? I tried to fix the size of the plot expected in to adjust but it doesn't seem to be the case. I plot it in the browser renderer.

pio.renderers.default='browser'

fig = px.scatter_3d(df_pmt, x='x', y='y', z='z',
                    color='Generation', size='Generation', size_max=18, opacity=0.9)
fig.update_layout(
    autosize=False,
    width=500,
    height=500
)

fig.show()
Adriaan
  • 17,741
  • 7
  • 42
  • 75
Marc
  • 651
  • 5
  • 16
  • Have a look at this: [link](https://stackoverflow.com/questions/31033791/plotly-same-scale-for-x-and-y-axis) – Yehla Jun 10 '22 at 06:24

2 Answers2

0

I guess you want to adjust axis ranges. You can use the method update_layout. For example:

fig.update_layout(xaxis_range=[0, 4], yaxis_range=[0, 4], zaxis_range=[0, 4])
Mykola Zotko
  • 15,583
  • 3
  • 71
  • 73
0

OK, found it in the doc, it can be fixed by using "Fixed Ratio Axes":

fig.update_layout(scene_aspectmode='cube')

Marc
  • 651
  • 5
  • 16