Multiple 3D Meshs with corrupted scale

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.

Hi @dvirginz,

Replace these lines of code:

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'

by:

fig.layout.update(width=800, height=800) 
fig.update_scenes(xaxis_visible=False, yaxis_visible=False,   zaxis_visible=False, camera=camera)         

To check that only two lines performed the same task as your removed lines
just display:

fig.layout

I tested the new version with the same Mesh3d included in both subplots and got this image:

Please read these description of aspectmode:

aspectmode
Parent: layout.scene
Type: enumerated , one of ( "auto" | "cube" | "data" | "manual" )
Default: "auto"
If "cube", this scene's axes are drawn as a cube, regardless of the axes' ranges. If "data", this scene's axes are drawn in proportion with the axes' ranges. If "manual", this scene's axes are drawn in proportion with the input of "aspectratio" (the default behavior if "aspectratio" is provided). If "auto", this scene's axes are drawn using the results of "data" except when one axis is more than four times the size of the two others, where in that case the results of "cube" are used.

If one of your meshes has the property mentioned in the last phrase above, then this could be the cause of inequal height of the two creatures.