How to create plot3 varying color figure?

조회 수: 16 (최근 30일)
Mohamad Reza Ghasemi
Mohamad Reza Ghasemi 2020년 3월 18일
답변: Cris LaPierre 2020년 3월 18일
Hello. I have a figure scipted with plot3 commend:
% XMat is equal for all figures
% Y1Mat, Y2Mat, Y3Mat, Y4Mat and Y5Mat are values between 0~0.5 which I want to colormap the figure based on them
plot3(XMat,40*ones(size(XMat)),Y1Mat(1,:),'LineWidth',2)
hold on
grid on
plot3(XMat,60*ones(size(XMat)),Y2Mat(1,:),'LineWidth',2)
plot3(XMat,80*ones(size(XMat)),Y3Mat(1,:),'LineWidth',2)
plot3(XMat,100*ones(size(XMat)),Y4Mat(1,:),'LineWidth',2)
plot3(XMat,120*ones(size(XMat)),Y5Mat(1,:),'LineWidth',2)
xlabel('X')
ylabel('Y')
zlabel('Z')
The result will be like this:
Now i want to assign a varying color to each curve. Something like this:
Now how can do this? Thanks all.

답변 (1개)

Cris LaPierre
Cris LaPierre 2020년 3월 18일
Short answer - not very easily. See this post.

카테고리

Help CenterFile Exchange에서 Color and Styling에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by