Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬Register for the Oct 27 webinar.

Mesh3d subplots

Hello.
Suppose that I want to create, say, 4 subplots (2 x 2), for simplicity, the same mesh3d object in all the subplots.
How I can I create “trace” from my “data” and “layout” ?
Thank you.

data = [
go.Mesh3d(
x = [0, 0, 1, 1, 0, 0, 1, 1],
y = [0, 1, 1, 0, 0, 1, 1, 0],
z = [0, 0, 0, 0, 1, 1, 1, 1],
colorbar = go.ColorBar(
title=‘z’
),
colorscale = [[0, ‘rgb(255, 0, 255)’],
[0.5, ‘rgb(0, 255, 0)’],
[1, ‘rgb(0, 0, 255)’]],
intensity = np.linspace(0,10,8),
i = [7, 0, 0, 0, 4, 4, 6, 6, 4, 0, 3, 2],
j = [3, 4, 1, 2, 5, 6, 5, 2, 0, 1, 6, 3],
k = [0, 7, 2, 3, 6, 7, 1, 1, 5, 5, 7, 6],
name=‘y’,
showscale=True
)
]
layout = go.Layout(
xaxis=go.XAxis(
title=‘x’
),
yaxis=go.YAxis(
title=‘y’
)
)

trace = ???
fig = tools.make_subplots(rows=2, cols=2)
fig.append_trace(trace, 1, 1)
fig.append_trace(trace, 1, 2)
fig.append_trace(trace, 2, 1)
fig.append_trace(trace, 2, 2)

Hi @vasily,

The approach used in this 3D surface subplots example (https://plot.ly/python/3d-subplots/#3d-surface-subplots) should work for mesh3d traces as well. In particular, note the use of the specs argument to make_subplots.

Hope that helps!
-Jon