How do I seperate datapoints in a plot?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Peng Li
el 4 de Abr. de 2020
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.
Respuestas (2)
Image Analyst
el 5 de Abr. de 2020
Editada: Image Analyst
el 5 de Abr. de 2020
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 comentarios
Ver también
Categorías
Más información sobre Scatter Plots en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!