How can I write the values of a colourmap on each object?

2 ビュー (過去 30 日間)
Pasquale
Pasquale 2017 年 11 月 10 日
コメント済み: Pasquale 2017 年 11 月 11 日
I have a mesh of triangular elements and a figure obtained with trisurf(tri,x,y,z). I insert the colorbar, where each colour represents the height z of triangles. Is it possible to write and display all the z values on the corresponding triangle?

採用された回答

KSSV
KSSV 2017 年 11 月 11 日
N = 10 ;
x = rand(N,1) ;
y = rand(N,1) ;
z = rand(N,1) ;
dt = delaunayTriangulation(x,y) ;
tri = dt.ConnectivityList ;
mx = mean(x(tri),2) ;
my = mean(y(tri),2) ;
mz = mean(z(tri),2) ;
trisurf(tri,x,y,z) ;
colorbar
view(2)
hold on
text(mx,my,mz,num2str(mz))

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Object Properties についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by