I have the example of the data below
a=[1,12;2,18;3,20];
b=[2,13;7,16;3,27; 4,22];
c=[7,23;2,13;8,18;3,15; 4,13];
Result=vertcat(a,b,c);
figure, scatter(Result(2,:), (Result(1,:))
xlabel('age')
ylabel('index')
This code provides me a plot of all the sample in an overall view, but I would like to show the result of each group of a, b,c ( with different size) in the same panel with different markers.
I look through MATLAB doc they have a example of gscatter but I did not understood how I can group the data to be able to present in it in the panel such as what you see below ( this panel is only an example how my figure should like and is a copy and paste only)
any help is highly appriciated
Just plot each color separately, probably the easiest option:
a=[1,12;2,18;3,20];
b=[2,13;7,16;3,27; 4,22];
c=[7,23;2,13;8,18;3,15; 4,13];
figure,
hold on
scatter(a(:,1),a(:,2),'g','filled')
scatter(b(:,1),b(:,2),'b','filled')
scatter(c(:,1),c(:,2),'r','filled')
grid on
xlabel('age')
ylabel('index')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.