Hello everyone!
I only started to use Plotly library and I need your help! Probably, my question is very easy.
I created a 3D surface defined by convexhull coordinates of a set of points. As a result, I have all points using go.Scatter3d (some of them inside, some of them as corners of created polyhedra), and a 3D surface using go.Mesh3d, but I want to highlight each edge between points of polyhedra to make the surface more visible.
Now I have this code:
fig = go.Figure()
polyhedra_points = [ ]
coordinates = result_fin[[‘Teta_N’, ‘Teta_V’, ‘Teta_chi’]].values
hull = scipy.spatial.ConvexHull(coordinates)polyhedra_points = hull.vertices.tolist()
coordinates_all = result_fin[[‘Teta_N’, ‘Teta_V’, ‘Teta_chi’]].to_numpy()
polyhedra_coordinates = coordinates_all[polyhedra_points]fig = go.Figure(data=[go.Scatter3d(x=result_fin.Teta_N, y=result_fin.Teta_V, z=result_fin.Teta_chi,
mode=‘markers’,
marker=dict(size = 2, color = ‘blue’),
)
]
)fig.add_trace(go.Mesh3d(x=polyhedra_coordinates[:, 0],
y=polyhedra_coordinates[:, 1],
z=polyhedra_coordinates[:, 2],
text = polyhedra_df.composition, #we see only the names of the polyhedra points
color=“blue”,
name=‘Laves’,
contour = dict(color = ‘blue’, show = True, width = 10),
#facecolor = polyhedra_coordinates,
flatshading=True, #helped a bit to see edges
lighting=dict(ambient=0.6, diffuse=0.8), #helped a bit to see edges
opacity=.4,
alphahull=0
),
)fig.update_traces(showlegend=True)
fig.update_layout(title=“Structural 3D map”,
legend_title=‘Phase name’,
scene=dict(
xaxis = dict(title=r’Theta_N’, nticks=10, range=[-1,1]),
yaxis = dict(title=r’Theta_V’, nticks=10, range=[-1,1]),
zaxis = dict(title=r’Theta_chi’, nticks=10, range=[-1,1]))
)fig.show()
With this code I have this plot:
I want to have something like this (this plot was done in matplotlib, I need edges like in it):
I marked as a comment #facecolor = polyhedra_coordinates - maybe using this parameter is it possible to highlight edges with the same colour that the points, but by this way, as I put it, it didn’t work. So, if I use this facecolor parameter then I have this result, but not highlighted edges:
Can you give me some recommendations how to get highlighted edges?
Thanks in advance!