after scatter3(), how to draw a contour line in the same figure?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
HONG CHENG
el 12 de Abr. de 2017
Respondida: Rollin Baker
el 14 de Abr. de 2017
Hi, everybody,I have draw a scatter3 picture and I want to add some counter lines in this piture. Any one can help me ? after using this,
scatter3(x,y,z)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/162868/image.png)
as you can see there are discrete points, but a lot of ponit have same value(z), so I want to add some counter lines to it like the next picture
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/162870/image.png)
what's more, my data(x,y,z) is discrete, all of them are
(2345*1 double)
1 comentario
Respuesta aceptada
Rollin Baker
el 14 de Abr. de 2017
Hi Hong,
As KSSV said, you just need to call 'hold on;' to plot both graphs on the same figure. I don't know exactly what your data looks like, but here is some example code that shows how to get a scatter plot and a contour map on the same figure.
x = -2:0.25:2;
y = -2:0.25:2;
z = x.*exp(-x.^2-y.^2);
scatter3(x, y, z);
hold on;
[X,Y] = meshgrid(x);
Z = X.*exp(-X.^2-Y.^2);
contour3(X,Y,Z,30);
I hope you find this example helpful. Good luck on your project!
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!