✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

Slice in an isosurface

Hi
My isosurface code is as follows
#############################################################
W = f(X,Y,Z)

axis = dict(
showbackground=True,
backgroundcolor=“rgb(230, 230,230)”,
showgrid=False,
zeroline=False,
showline=False)

ztickvals=list(range(0,4))
layout = go.Layout(title=“Projections of a surface onto coordinate planes” ,
autosize=False,
width=500,
height=500,
scene=dict(xaxis=dict(axis, range=[0, 1]),
yaxis=dict(axis, range=[0, 1]),
zaxis=dict(axis , range=[0, 1]),
aspectratio=dict(x=0.1,
y=0.1,
z=0.1)
)
)

data=go.Isosurface(
x=X.flatten(),
y=Y.flatten(),
z=Z.flatten(),
value=W.flatten(),
isomin=-0.5,
isomax=-0.5,
showscale=False,
caps=dict(x_show=False, y_show=False),
slices_z=dict(show=True, locations=[0.5]),
)

fig = go.Figure(data=data,layout=layout)

fig.show()
#################################################

Now, I want add contour plot “f(x ,y ,z = 0)” in xy plan. In fact, I want combine two figures: Isosurface f(x,y,z) in my top code and contour plot “f(x ,y ,z = 0)” which belongs in xy plan. In this case, the contour plot looks like a shadow of the Isosurface.

my two mention figures are similar as follows

image

@hamed

I tried first to plot central slices in two spheres, defined as isosurfaces. Their quality is poor and the volume of required memory is big:

https://plotly.com/~empet/15611 (download this notebook and run it).

Instead I defined both spheres and slices as surfaces, and chose the colorscales to imitate the slices in isosurfaces:
https://plotly.com/~empet/15612.

Tanks a lot
but i cannot run these codes in google colab. The result is: