I am looking to be able to plot an stl file in Python. I can do it in Matlab easily enough with this code:
phacon = stlread("Spine_PhaconModel.stl");
hold on
figure = trisurf(phacon,'FaceColor',[0.6 0.6 0.6], 'Edgecolor','none','FaceLighting','gouraud','AmbientStrength', 0.15, 'MarkerEdgeColor',"r")
view([180, -1])
camlight('headlight');
material('dull');
But when I try to change the code to Python, the output is not what I want. The output plot I'm looking for is something like what is attached below: Spine ouput from matlab
I tried using functions such as mesh.Mesh.from_file to get the data as an equivalent of the Matlab function stlread() and plot_trisurf as an equivalent of the Matlab function trisurf(). The code I tried is:
fig = plt.figure()
ax = fig.gca(projection='3d')
stl_data = mesh.Mesh.from_file('Spine_PhaconModel.stl')
points = stl_data.points.reshape([-1, 3])
x = points[:,0]
y = points[:,1]
z = points[:,2]
collec = ax.plot_trisurf(x,y,z,linewidth=0.2)
However, I don't know how to make it look visually the same as the first attached image. What I get is this Spine Phacon output using Python
I would really appreciate the help, thanks so much!