How to change color in a 3d plot depending from the value in each position?

조회 수: 10 (최근 30일)
Dimitrios
Dimitrios 2014년 11월 14일
편집: Mike Garrity 2014년 11월 14일
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.

답변 (1개)

Mike Garrity
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.

카테고리

Help CenterFile Exchange에서 Animation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by