Combine surf and scatter3 in one axes

I want to combine a surf and a scatter3 in a single axes so that the scatter points are displayed above or below the surface (dependent of there Z value) in the same coordinate system.
When creating surf or scatter3 the axes handle is provided as a first parameter
surf( handles.myAxes, ...
scatter( handels.myAxes, ...
I also tried
surf( handles.myAxes, ...
hold on;
scatter( handels.myAxes, ...
The result remains always the same. Only the scatter3 points are shown in axes. The surf is invisible.
My questions
1) Is it possible to combine a surf and a scatter3 in a single axes at the same time? (Didn't find any hints on this limitation in the docs) 2) If yes how can this be achieved?

 Respuesta aceptada

Mischa Kim
Mischa Kim el 6 de Mzo. de 2014
Editada: Mischa Kim el 6 de Mzo. de 2014
Thomas, what happens if you execute the following code? With and without the get command?
k = 5;
n = 2^k-1;
[x,y,z] = sphere(n);
surf(x,y,z);
get(gcf, 'Renderer')
hold on
[X,Y,Z] = sphere(16);
xx = 2*[0.5*X(:); 0.75*X(:); X(:)];
yy = 2*[0.5*Y(:); 0.75*Y(:); Y(:)];
zz = 2*[0.5*Z(:); 0.75*Z(:); Z(:)];
scatter3(xx,yy,zz)
get(gcf, 'Renderer')
Is this the behavior you are looking for?

2 comentarios

Thomas
Thomas el 6 de Mzo. de 2014
This is exactly what I wanted to achieve. I don't see any difference in executing the script with or without get command. Should there be any difference visible?
Walter Roberson
Walter Roberson el 6 de Mzo. de 2014
I suspect Mischa wanted you to check to see if the same renderer was being used in both cases. Which I would expect would happen, but renderers cause surprising issues.
If you now comment out the get() calls does the code function?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Discrete Data Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 6 de Mzo. de 2014

Comentada:

el 6 de Mzo. de 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by