The colors of 3d plot surfaces do not match the Colorbar

2 ビュー (過去 30 日間)
Christian Brembilla
Christian Brembilla 2017 年 4 月 12 日
回答済み: Fei Deng 2017 年 4 月 17 日
Hi to all, my goal is to get some color maps in 2D built up from 3 vectors. The vectors are the x,y and z coordiante of points. I already tried several other methods and I do not want to built a mesh for the coordiante Z. Therefore, I applied to the following 3 vectors:
X=[1 3 1 4 5 1];
Y=[5 4 3 5 1 4];
Z=[100 105 105 100 115 102.6];
the function trisurf.
trisurf(delaunay(X,Y),X,Y,Z)
view(2);
Unfortunatly, the color of the surfaces do not match with the Colorbar (located on the right side of the image). As you can see, the point (5,1) has Z value of 115 which matches to yellow color in the Colorbar.
Would it be possible to blur the surfaces in order to see all the colors according to the Colorbar? Best regards, Christian

回答 (1 件)

Fei Deng
Fei Deng 2017 年 4 月 17 日
You are using trisurf(Tri,X,Y,Z) where color is proportional to surface height. Color of each triangle is determined by the height (averaged) of that triangle, which consists of (5,1), (4,5), and (3,4), or (5,1), (3,4) and (1,3). However you are expecting the color according to a certain point (5,1).
If you want the area close to point (5,1) painted as yellow, then you need to make more and smaller triangles, and mesh can do that.

Community Treasure Hunt

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

Start Hunting!

Translated by