How do I seperate datapoints in a plot?
1 回表示 (過去 30 日間)
古いコメントを表示
Hello everybody,
I have a problems with solving something in Matlab. I have a random dataset S (which is given) which is a matrix of 600x3. I plotted that dataset with scatter3 in a threedimensional graph. Next to this, I have a line with the function y=0.7*x+0.5. You can see this all together in the picture. Now i want to seperate all the scattered point of S that are above the line y and plot all those points in red instead of in blue. How is it possible to do this?
Thanks in advance!
This is my script:
load(S)
figure(3)
scatter3(S(:,1),S(:,2),S(:,3)); % see above figure
xlabel('S_1')
ylabel('S_2')
zlabel('S_3')
axis('equal')
view(5,85)
hold on
x=-3:0.01:2.99;
y=0.7*x+0.5;
plot(x,y)
2 件のコメント
Peng Li
2020 年 4 月 4 日
How do you define “above line y” given this 3D problem? In terms of what? Z? Your line exists only in plane x-y; there aren’t any z values.
回答 (2 件)
Image Analyst
2020 年 4 月 5 日
編集済み: Image Analyst
2020 年 4 月 5 日
Have you tried masking?
indexes = S(:, 2) > y;
S_AboveLine = S(indexes, :);
Attach your S data in a .mat file if you need more help.
Have you tried a clustering method like kmeans, svm, or dbscan?
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Scatter Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!