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

2 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Graphics Object Properties 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by