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 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