showing different parts of a dataset with different symbols in a scatterplot
显示 更早的评论
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
回答(3 个)
Sean de Wolski
2014-11-12
% 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
2014-11-12
0 个投票
1 个评论
Sean de Wolski
2014-11-13
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)
类别
在 帮助中心 和 File Exchange 中查找有关 Scatter Plots 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!