showing different parts of a dataset with different symbols in a scatterplot
Ältere Kommentare anzeigen
Hello there
I have a small and confusing question, would you please tell me how to show my data with different symbols within a scatter plot?? lets say I wanna create a scatter plot which has 60 inputs, I would like to show the first 20 with for instance triangle, the next 10 with circles and the rest with asterisks. I think it could be easy but I got totally confused about it. thank you all in advance
Antworten (3)
Sean de Wolski
am 12 Nov. 2014
% Synthetic data
x = rand(60,1);
y = rand(60,1);
% Plotting
scatter(x(1:20),y(1:20),'r*');
hold on
scatter(x(21:30),y(21:30),'b^');
scatter(x(31:end),y(31:end),'g<');
Nima
am 12 Nov. 2014
0 Stimmen
Nima
am 12 Nov. 2014
0 Stimmen
1 Kommentar
Sean de Wolski
am 13 Nov. 2014
Then calculate the refline coefficients with polyfit with the whole dataset:
% Synthetic data
x = cumsum(rand(60,1));
y = cumsum(rand(60,1));
% Plotting
scatter(x(1:20),y(1:20),'r*');
hold on
scatter(x(21:30),y(21:30),'b^');
scatter(x(31:end),y(31:end),'g<');
mb = polyfit(x,y,1);
refline(mb)
Kategorien
Mehr zu Scatter Plots finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!