anyway to color 2D triangular plot with "CData"

4 次查看(过去 30 天)
Hi:
I have a 2D triangulation data including vertices and connectivity, I want to color it with the value at its geometry center. I tried to add a "CData" but it is not recognized by "triplot" function:
Tri=triplot(DT.ConnectivityList,DT.Points(:,1),DT.Points(:,2),'CData',cm);
where DT is the triangulation objective, and cm is the color at each triangle center.
is there anyway in Matlab can do this?
Thanks!
Yu

回答(1 个)

KSSV
KSSV 2020-12-13
编辑:KSSV 2020-12-13
Read about trisurf. Also have a look on patch. You can use any of the two to achieve what you want.
  2 个评论
Yu Li
Yu Li 2020-12-13
Hi:
thanks for your reply.
"patch" seems works but by assigning "FaceVertexCData", but "trisurf" not.
I tried to use command:
Tri=trisurf(DT,DT.Points(:,1),DT.Points(:,2));
and below is the error messange:
Error using trisurf (line 65)
The triangulation must reside in 3D space.
do you have any further suggestions?
Thanks!
Yu
KSSV
KSSV 2020-12-14
Tri=trisurf(DT.ConnectivityList,DT.Points(:,1),DT.Points(:,2),cm);
I am assuming that cm is a column array with same number of rows present in Dt.Points.

请先登录,再进行评论。

类别

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