How to change color in a 3d plot depending from the value in each position?
2 次查看(过去 30 天)
显示 更早的评论
I am trying to simulate the loads from air in a vertical wind turbine.I would like to visualize these results.I upload these two picture to be more clear:
This is a simple plot3 i made to visualize the turbine.And lets say that this plot is the force versus Height.
How can in the first figure depending on the value of the load to change the color of the specific position in order to visualize the 'strentgh' of the load?Something like mesh function doing.Btw is it possible to use 'facecolor','interp' somehow?(I dont really need to do it.But i just thought of that and wanted to impliment it).Thanks in advance.
0 个评论
回答(1 个)
Mike Garrity
2014-11-14
编辑:Mike Garrity
2014-11-14
You can't with plot3, but you can if you use patch. It's not obvious, but you can use patch to draw lines with interpolated colors. You just set FaceColor to none.
ang = linspace(0,2*pi,40)
x = repmat(cos(ang)',[1 15]);
y = repmat(sin(ang)',[1 15]);
z = repmat([1:15],[40 1]);
h = patch(x,y,z,z)
h.FaceColor = 'none';
h.EdgeColor = 'interp';
One other trick is that if you don't want patch to close those loops for you, then you need to end each one with a nan.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polygons 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!