Plot data with MATLAB biplot with more than 1 color -
i have 3 groups of data had pca performed on them 1 group. want highlight each variable group different color. prior overlaid 3 biplots. gives different colors creates distortion in data each biplot function skews data. caused groups skewed different amounts, making plot not correct representation.
how take pca scores matrix (30x3) , split first 10x3 1 color, next 10x3 , third 10x3 another, without data being skewed?
"skewing" happening because biplot renormalizing scores farthest score distance 1 . axis equal
isn't going fix this. should use scatter3
instead of biplot
data = rand(30,3); group = scores(1:10,:) scatter3(group(:,1), group(:,2), group(:,3), '.b') hold group = scores(11:20,:) scatter3(group(:,1), group(:,2), group(:,3), '.r') group = scores(21:30,:) scatter3(group(:,1), group(:,2), group(:,3), '.g') hold off title('data') xlabel('x') ylabel('y') zlabel('z')
or modify code's scatter3 lines markers different colors. parameter after 'marker' tells symbol , symbol , color plot. e.g. '.r' red dot. see linespec marker , color parameters.
scatter3(plotdataholder(1:14,1),plotdataholder(1:14,2),plotdataholder(1:14,3),35,[1 0 0],'marker', '.b'); hold on; scatter3(plotdataholder(15:28,1),plotdataholder(15:28,2),plotdataholder(15:28,3),35,[0 0 1],'marker', '.r') ; scatter3(plotdataholder(29:42,1),plotdataholder(29:42,2),plotdataholder(29:42,3),35,[0 1 0],'marker', '.g');
Comments
Post a Comment