Black Lives Matter. Please consider donating to Black Girls Code today.

Vertical surface with 3d topography

Hi,

I want to add vertical surface to 3d topographical surface. The top of vertical surface should fit the topography, bottom part might be constant level.

(Vertical surface will stand for fault plane )

How can I do that ?

regards

Hi @doga,

Could you give more details on that “vertical surface”? Eventually paste here or upload somewhere data to plot it.

Thank you,

I want fault_surface to be perpendicular to x-axis. ( right angle with x axis)

in my following case, it generates a plane that is parallel to x axis:

I tried:

x = np.linspace(-np.pi, np.pi, 100)
y = np.linspace(-np.pi, np.pi, 100)
X, Y = np.meshgrid(x, y)
Z1 = np.cos(X)*np.sin(Y) # topography surface

trace1 = go.Surface(z=Z1, colorscale=‘Viridis’)

fault_level=1.0#plot a z-plane at height 1
z=fault_level*np.ones(X.shape)

#fault_surface=dict(type=‘surface’, x=X, y=Y, z=z,colorscale=‘Greys’, showscale=False)

fault_surface= go.Surface(z=z , colorscale=‘Greys’)

@doga Your description is a bit confusing: you say vertical surface but in code you inserted z.

If it is orthogonal on xaxis this means that the fault _surface is parallel to the plane yOz. In this case you should give the distance d from origin to the fault_surface.

This is a code to plot the fault_surface as a plane of equation z=1:

x = np.linspace(-np.pi, np.pi, 100)
y = np.linspace(-np.pi, np.pi, 100)
X, Y = np.meshgrid(x, y)
Z = np.cos(X)*np.sin(Y) # topography surface

trace1 = go.Surface(x=X, y=Y, z=Z, colorscale='Viridis',
                   colorbar_len=0.5, colorbar_thickness=25)

fault_level=1.0#plot a z-plane at height 1

xx = np.linspace(-np.pi,np.pi, 100)
yy = np.linspace(-np.pi,np.pi, 100)
XX, YY = np.meshgrid(xx, yy)

ZZ=fault_level*np.ones(XX.shape)

fault_surface=go.Surface(x=XX, y=YY, z=ZZ, surfacecolor= ZZ, colorscale='Greys', showscale=False)

fig= go.Figure(data=[ trace1, fault_surface])
fig.update_layout(width=600, height=500, 
                  scene_camera_eye_x=1.35, 
                  scene_camera_eye_y=1.35,
                  scene_camera_eye_z=0.5)

and yhis one for a plane of equation x=1:

x = np.linspace(-np.pi, np.pi, 100)
y = np.linspace(-np.pi, np.pi, 100)
X, Y = np.meshgrid(x, y)
Z = np.cos(X)*np.sin(Y) # topography surface

trace1 = go.Surface(x=X, y=Y, z=Z1, colorscale='Viridis',
                   colorbar_len=0.5, colorbar_thickness=25)

fault_level=1.0#plot a z-plane at height 1

yy = np.linspace(-np.pi,np.pi, 100)
zz = np.linspace(-np.pi,np.pi, 100)
yy, zz = np.meshgrid(yy, zz)

xx=fault_level*np.ones(yy.shape)

fault_surface=go.Surface(x=xx, y=yy, z=zz, surfacecolor= xx, colorscale='Greys', showscale=False)

fig= go.Figure(data=[ trace1, fault_surface])
fig.update_layout(width=600, height=500, 
                  scene_camera_eye_x=1.35, 
                  scene_camera_eye_y=1.35,
                  scene_camera_eye_z=0.5)

Depending on which one is what you expected you can change some fault_surface attributes to meet your requirements.