showing different parts of a dataset with different symbols in a scatterplot
Afficher commentaires plus anciens
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
Réponses (3)
Sean de Wolski
le 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
le 12 Nov 2014
0 votes
Nima
le 12 Nov 2014
0 votes
1 commentaire
Sean de Wolski
le 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)
Catégories
En savoir plus sur Scatter Plots dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!