필터 지우기
필터 지우기

plot two figures with same colorscale

조회 수: 4 (최근 30일)
Herlan
Herlan 2014년 11월 12일
답변: Luuk van Oosten 2014년 11월 17일
Hi all,
I want to plot x,y,z data with z as time series data in several figures. I want to plot using plot3. However, I found difficulties to plot that figures in same color scale. I have make a script like this :
clear;
x=xlsread('Merapideformation.xlsx', 'A:A');
y=xlsread('Merapideformation.xlsx', 'B:B');
z1=xlsread('Merapideformation.xlsx', 'D:D');
z2 = xlsread('Merapideformation.xlsx', 'E:E');
clear Merapideformation
bottom = min(min(min(z1)), min(min(z2)));
top = max(max(max(z1)), max(max(z2)));
subplot(1,2,1)
plot3(x,y,z1,'.');
view (5,90)
caxis manual
caxis ([bottom top]);
subplot(1,2,2)
plot3(x,y,z2,'.')
view (5,90)
caxis manual
caxis ([bottom top]);
colorbar;
However, when I run the script, the plot was just in blue color. It makes me difficult to analyze in time series. Does anybody can help me? thank you in advance.

답변 (2개)

Hugo
Hugo 2014년 11월 12일
If I understood correctly, you want the colour to vary according to the value of "z". But the problem is that plot3 takes only one colour for the whole line. Furthermore, the colour is not affected by caxis.
The solution may be to use scatter3 instead. It seems that you are just plotting points, so it should be fine. Hope this helps.
  댓글 수: 2
Herlan
Herlan 2014년 11월 12일
Yes, I want to compare z value in the same region but in different time. I already tried to use scatter3 but the color scale was different. So, it made me difficult to analyze the spatial changing in different time.
Do you have an idea to make two or more figures with same colorscale in matlab? using plot3 or scatter3? thanks
Hugo
Hugo 2014년 11월 17일
Sorry for the delay.
The colour scale in scatter3 can be modified with caxis and thus can be made the same. The colours of each point in scatter3 can be specified as one of the inputs of scatter3. That is, if you write scatter3(x,y,z,10,z), it would plot points of size 10 and each point will have a colour proportional to the value of z in that point. Then the colormap can be changed using the command "colormap" followed by some predefined value or by a colormap of your own
Hope this helps.

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


Luuk van Oosten
Luuk van Oosten 2014년 11월 17일
I tried something similar with scatter3. A slight modification of this answer will solve your problem.

카테고리

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