Is there any option like zline?

47 visualizaciones (últimos 30 días)
Nitin Phadkule
Nitin Phadkule el 23 de Jul. de 2021
Comentada: Chunru el 3 de Ag. de 2021
I have drawn a 3D plot in app.UIAxes and added x and y axis by xline and y line, but not able to add zaxis line. why I am doing this because in 3D plots, axis is not located at origin. Is there any option like zline?

Respuesta aceptada

Chunru
Chunru el 23 de Jul. de 2021
If all you want is to plot x-y-z axis passing through origin, then you can do the following. (assuming that origin is somewhere inside the plot; otherwise set the xlim, ylim, zlim first).
x=(-2:.1:1);
y = (-1:.1:2);
z = peaks(x, y');
mesh(x,y,z);
hold on
xlabel('x'); ylabel('y'); zlabel('z');
h = gca;
plot3(h.XLim, [0 0], [0 0], 'r')
plot3([0, 0], h.YLim, [0 0], 'r');
plot3([0, 0], [0 0], h.ZLim, 'r');
view(60, 10)
  3 comentarios
Chunru
Chunru el 3 de Ag. de 2021
Thanks for sharing.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by