rank the point in scatter3d figure with different color
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
HONG CHENG
le 11 Avr 2017
Réponse apportée : HONG CHENG
le 11 Avr 2017
Dear everyone,
I want to draw a figure with 3-d data (x,y,values),and I want to rank the values then the different ranks value are with different color as you can see from figure2.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/162831/image.bmp)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/162832/image.bmp)
Anyone know the answer?Thanks in advance.
Hong Cheng
0 commentaires
Réponse acceptée
Plus de réponses (2)
KSSV
le 11 Avr 2017
Modifié(e) : KSSV
le 11 Avr 2017
x = rand(100,1) ;
y = rand(100,1) ;
z = rand(100,1) ;
%%get indices according to values
idx = 1:100 ;
idx1 = z >0. & z<=0.4 ;
idx2 = z >0.5 & z<=0.8 ;
idx3 = z >0.8 & z<=1 ;
%%plot
figure
hold on
scatter3(x(idx1),y(idx1),z(idx1),'r','filled')
scatter3(x(idx2),y(idx2),z(idx2),'b','filled')
scatter3(x(idx3),y(idx3),z(idx3),'g','filled')
Voir également
Catégories
En savoir plus sur Get Started with Curve Fitting Toolbox 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!