Iβm trying to plot two meshs one next to the other.
Using the following code, I was able to plot them:
from plotly.offline import plot
from plotly.subplots import make_subplots
import plotly.graph_objects as go
fig = make_subplots(
rows=1, cols=2, specs=[[{'type': 'mesh3d'}, {'type': 'mesh3d'}]],
horizontal_spacing=0.0)
fig.add_trace(go.Mesh3d(
# 8 vertices of a cube
x=source_mesh.vert[:,0],
y=source_mesh.vert[:,1],
z=source_mesh.vert[:,2],
# i, j and k give the vertices of triangles
i = source_mesh.triv[:,0],
j = source_mesh.triv[:,1],
k = source_mesh.triv[:,2],
vertexcolor = np.concatenate([color_map_vis,np.ones(color_map_vis.shape[0])[:,None]],axis=1),
showlegend = False,
hoverinfo='skip'
),
row=1, col=1)
fig.add_trace(go.Mesh3d(
# 8 vertices of a cube
x=target_mesh.vert[:,0],
y=target_mesh.vert[:,1],
z=target_mesh.vert[:,2],
# i, j and k give the vertices of triangles
i = target_mesh.triv[:,0],
j = target_mesh.triv[:,1],
k = target_mesh.triv[:,2],
vertexcolor = np.concatenate([color_map_vis,np.ones(color_map_vis.shape[0])[:,None]],axis=1),
showlegend = False,
hoverinfo='skip'
),
row=1, col=2)
camera = dict(
up=dict(x=0, y=1., z=0),
eye=dict(x=-0.0, y=-0.0, z=2.5)
)
fw=fig
with fw.batch_update():
fw.layout.update(width=800, height=1000)
fw.layout.scene.camera=camera
fw.layout.scene.xaxis.showgrid=False
fw.layout.scene.yaxis.showgrid=False
fw.layout.scene.zaxis.showgrid=False
fw.layout.scene.aspectmode: 'auto'
fw.layout.scene2.camera=camera
fw.layout.scene2.xaxis.showgrid=False
fw.layout.scene2.yaxis.showgrid=False
fw.layout.scene2.zaxis.showgrid=False
fw.layout.scene2.aspectmode: 'auto'
fig.write_image("fig.png")
Unfortunately, this is the result:
As you can see, one of the objects is always scaled in a really weird manner, and I simply canβt understand what it the pattern, as each new pair I try, the one being warped is different.