Plot different classes in different colors
4 次查看(过去 30 天)
显示 更早的评论
I' m doing a pca and I want make a general function to plot two different classes in different colors( blue square, red circle) in the same figure and i want to use this funtion in any other experiment
Resuming: for the data above, the values of class 1 must be in different color in the class 2 in the same figure
for example
Var1 Var2 Var*n* Class
2.3 0.22 12 1
2.4 0.23 11 1
2.8 0.21 15 2
2.1 0.21 16 1
2.9 0.23 14 2
Best regards Rafael
2 个评论
bym
2011-4-6
do you want to plot Var1 vs Var2, or each variable in a separate plot colored according to class?
采纳的回答
Walter Roberson
2011-4-6
class1 = V(:,4) == 1;
plot3(V(class1,1), V(class1,2), V(class1,3), 'bs.');
hold on
plot3(V(~class1,1), V(~class1,2), V(~class1,3), 'ro.');
3 个评论
更多回答(2 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Specifying Target for Graphics Output 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!