plot3 temperature color

조회 수: 3 (최근 30일)
Michela Longhi
Michela Longhi 2017년 8월 1일
댓글: José-Luis 2017년 8월 1일
Hi, I have this plot 3d:
figure()
plot3(X,Y,Z)
where X and Y are coordinate and Z is the correspondent temperature value for each couple of (x,y), as for exampe: x1=0, y1=0, z1=28°C...
But now, I want to color the plot changing the color depending from the temperature.
How can I do? Please, help me
Thanks,
Michela

답변 (3개)

KSSV
KSSV 2017년 8월 1일
편집: KSSV 2017년 8월 1일
You need to plot a scatter plot. Read about scatter and scatter3
  댓글 수: 1
Michela Longhi
Michela Longhi 2017년 8월 1일
Can you please give ma an example?

댓글을 달려면 로그인하십시오.


José-Luis
José-Luis 2017년 8월 1일
Looks like you are looking for scatter3().
  댓글 수: 2
Michela Longhi
Michela Longhi 2017년 8월 1일
My code is:
fileID_A=fopen('coordinate.txt');
A = textscan(fileID_A,'%f %f %f');
X=A{2};
Y=A{3};
Z=A{1};
figure()
scatter3 (X,Y,Z)
colormap(jet);
colorbar;
But it not works, why? Thank you
José-Luis
José-Luis 2017년 8월 1일
It not works is not a helpful description of your problem. What do you get and what do you expect?
Is there an error message and if so, what is it?

댓글을 달려면 로그인하십시오.


Michela Longhi
Michela Longhi 2017년 8월 1일
I wrote:
plot3(X,Y,Z)
c = 1:numel(Y); %# colors
h = surface([X(:), X(:)], [Y(:), Y(:)], [Z(:), Z(:)], [c(:), c(:)], 'EdgeColor','flat', 'FaceColor','none','Linewidth',2);
colormap( jet(numel(Y)) )
But I want that the color change with the temperature value. How can I do???

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by