MATLAB Answers

How to scatter3 row vector with different colors

1 view (last 30 days)
Norsalina Hassan
Norsalina Hassan on 27 Jul 2021
Commented: KSSV on 28 Jul 2021
Hi,
I have 3 row vectors (3x510 double). I want to use different color for each row. How can I plot using scatter3 function?
Please help.
Thanks in advance.
  2 Comments
Norsalina Hassan
Norsalina Hassan on 27 Jul 2021
This is what I did before
scatter3(OMEGA(1,:), OMEGA(2,:), OMEGA(3,:),'b*'), but i need each row to be different colors

Sign in to comment.

Answers (1)

KSSV
KSSV on 27 Jul 2021
Edited: KSSV on 27 Jul 2021
LEt A be your 3*510 matrix.
x = A(1,:) ;
y = A(2,:) ;
z = A(3,:) ;
scatter(x,y,10,z,'.');
If you want to use scatter3.
scatter3(x,y,z,100,z,'.');

Tags

Community Treasure Hunt

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

Start Hunting!