79203129

Date: 2024-11-19 11:04:09
Score: 0.5
Natty:
Report link

The problem is your go.Surfaece trace definitions. In Plotly, you need to provide grids for x,y and z that align with the surface your are plotting.

Define grids for each plane:

x = np.linspace(0, 2, 3)
y = np.linspace(0, 2, 3)
z = np.linspace(0, 2, 3)


# Z-plane (constant z=1)
z_plane = np.ones((3, 3))  # z is constant
zsurf = go.Surface(x=np.outer(x, np.ones(3)), y=np.outer(np.ones(3), y), z=z_plane)

# Y-plane (constant y=1)
y_plane = np.ones((3, 3))  # y is constant
ysurf = go.Surface(x=np.outer(x, np.ones(3)), y=y_plane, z=np.outer(np.ones(3), z))

# X-plane (constant x=1)
x_plane = np.ones((3, 3))  # x is constant
xsurf = go.Surface(x=x_plane, y=np.outer(y, np.ones(3)), z=np.outer(np.ones(3), z))

Create the figure and add the surfaces

fig = go.Figure()
fig.add_trace(zsurf)
fig.add_trace(ysurf)
fig.add_trace(xsurf)

enter image description here

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: EuanG