create a mesh from the "scatter3" command
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Is it possible to create a mesh from the "scatter3" command (and keep the colors on the mesh) ?
0 comentarios
Respuestas (1)
Walter Roberson
el 27 de Dic. de 2020
Yes, it is possible. If you record the handle of the scatter3(), then you can fetch the XData, YData, ZData and CData properties to give the coordinates of the points (but it would have been easier to just use the expressions you passed to scatter3() )
Once you have the coordinates, you can use https://www.mathworks.com/help/matlab/ref/delaunay.html delaunay() to produce a triangulation. You can then trimesh() to plot it:
T = delaunay(x, y, z);
h = trimesh(T, x, y, z, c, 'FaceColor', 'none');
2 comentarios
Walter Roberson
el 27 de Dic. de 2020
Perhaps you should describe the difference between what you wanted and what you obtained. Attaching data and sample plots would help.
Note: it is common that when you have scattered points in 3 space that triangulation ends up joining what you are thinking of as being in different "layers". It is also common for points to end up joined across ends of a curve when you are only expecting joining along the curve.
Remember that the order of points in scatter3 does not give any information about how the points are joined. If you have information about how the points are joined, then you should use that information instead of fetching information from scatter3.
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!