필터 지우기
필터 지우기

anyway to color 2D triangular plot with "CData"

조회 수: 2 (최근 30일)
Yu Li
Yu Li 2020년 12월 13일
댓글: KSSV 2020년 12월 14일
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