plot two figures with same colorscale
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (2)
Hugo
le 12 Nov 2014
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 commentaires
Hugo
le 17 Nov 2014
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
le 17 Nov 2014
I tried something similar with scatter3. A slight modification of this answer will solve your problem.
0 commentaires
Voir également
Catégories
En savoir plus sur Orange dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!