开发者

Matlab, plotting classes of points in specific areas in axis

Hi and thanks for any help in advance, i am in the process of plotting a series of classified points in an axis. What i am trying to achieve is to have the plotted classes, which are in different colors dependant upon their class, is to have each of the classes plotted in each corner of the axis area.


This is my plot command

DATA = [X labels];
Z =开发者_JAVA技巧 (DATA(:,3)); % select all row three as classes
plot (DATA (Z == 1, 1), DATA (Z == 1, 2), 'k.', 'markersize', 5)
hold on
grid on
plot (DATA (Z == 2, 1), DATA (Z == 2, 2), 'rx', 'markersize', 5)
plot (DATA (Z == 3, 1), DATA (Z == 3, 2), 'g^', 'markersize', 5)
plot (DATA (Z == 4, 1), DATA (Z == 4, 2), 'b.', 'markersize', 5)

I need to plot each class in each corner of the axis

Thanks

Chris


Is this what you want to plot?

DATA = [rand(10,2),round(rand(10,1)*4)];% sample data

Z = DATA(:,3);

figure; hold on; axis tight; axis equal; grid on; box on;

p1=plot (DATA (Z == 1, 1), DATA (Z == 1, 2), 'k.', 'markersize', 5);

p2=plot (DATA (Z == 2, 1), DATA (Z == 2, 2), 'rx', 'markersize', 5);

p3=plot (DATA (Z == 3, 1), DATA (Z == 3, 2), 'g^', 'markersize', 5);

p4=plot (DATA (Z == 4, 1), DATA (Z == 4, 2), 'b.', 'markersize', 5);

legend([p1,p2,p3,p4],'Apple','Carrot','Orange','Banana')

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜