plot two figures with same colorscale
3 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(2 个)
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 个评论
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
2014-11-17
I tried something similar with scatter3. A slight modification of this answer will solve your problem.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Orange 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!