How to plot a wireframe mesh setting different color per edge ?

2 次查看(过去 30 天)
Hi, I'm trying to plot a mesh with a specific color per edge and no color for the faces. The problem with existing functions (that I know of) is that I can set the EdgeColor property to be the same for all edges, or interpolate the colors I set for the vertices on the edges ('interp '). Does anyone has an idea? Thanks!

采纳的回答

Walter Roberson
Walter Roberson 2015-10-11
Not exactly. EdgeColor 'flat' gives you an additional option:
Draw uniform edge colors. Use the CData value of the first vertex of the face to determine the color for each edge
Unfortunately when you use mesh() you create a "Chart Surface Object" (newer releases) or a surface() (older releases), and you do not get any control over the order in which the vertices are used to determine the color of the face.
If you were to use patch() instead of mesh() you could create the Faces property explicitly, allowing you to determine which is the "first" vertex for the purpose of "flat" coloring. patch() and surface objects are quite similar in that regards, but patch() offers also FaceVertexCData as well as CData properties (and I am not sure at the moment why you would use one or the other.)
Either way, mesh() or surface() or patch(), you have the difficulty that there are more edges than vertices.
Where does this leave you?
  • plot3() to have each edge drawn as a distinct line
  • patch() with duplicating a whole bunch of data so you have as many vertices as you wanted edges in the original mesh

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by