MATLAB Plot with RGB Color
16,561
I found the answer. You simply need to plot the points like this :
plot3(m(i,1) , m(i,2) , m(i,3) , 'Color' , [0.5 0.5 0] , 'Marker' , '*');
or
plot3(m(i,1) , m(i,2) , m(i,3) , 'Color' , [r g b] , 'Marker' , '*');
Author by
jeff
Updated on June 04, 2022Comments
-
jeff almost 2 years
I have a matrix with sample points from different classes. Let's say they are features from 10 subjects, and there are 80 samples per subject.
So I have a 800 x 3 matrix.
I want to plot it using the rows as 3D points, so I use this :
hold on; for i=1:length(m) plot3(m(i,1) , m(i,2) , m(i,3) , 'r*'); end
this works but the argument
'r*'
plots all the points as red asterisks.But I want to plot every class as a different color. So whenever
i%80==0
I need to change the color argument with an RGB vector. How can I do this?Thanks for any help!
-
buzjwa about 10 yearsThat's correct. You can find other solutions here.