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

2 ビュー (過去 30 日間)
Anna Shtengel
Anna Shtengel 2015 年 10 月 11 日
コメント済み: Anna Shtengel 2015 年 10 月 11 日
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 Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by