Plot multiple contours in 3D without volume data
Mostrar comentarios más antiguos
I am trying to plot multiple contours in the same 3D plot without volume data. The resulting plot would look like a slice plot with, for example, two orthogonal planes each showing a contour. Instead, I have data for two different contours that I would like to put in the same 3D plot orthogonal to each other. I have seen answers that allow you to plot multiple contours in 3D if you have volume data (contourslice or slice) or to plot multiple 2D lines in 3D using plot3, but I haven't seen version that can do what I'm looking for.
Respuesta aceptada
Más respuestas (1)
You can use surf
t = linspace(0,2*pi,50);
[x1,y1] = pol2cart(t,1+0.1*sin(5*t)); % first contour
[x2,y2] = pol2cart(t,1); % second contour
[x3,y3] = pol2cart(t,0.5); % third contour
v0 = x1*0;
X = [v0; x1; x2; x3; v0]; % contantenate
Y = [v0; y1; y2; y3; v0];
Z = [v0; v0; v0+1; v0+2; v0+2];
surf(X,Y,Z,'facecolor','r','edgecolor','none')
line([x1 nan x2 nan x3],...
[y1 nan y2 nan y3],...
[v0 nan v0+1 nan v0+2], 'linewidth',2)
light
1 comentario
Daniel
el 14 de Sept. de 2021
Categorías
Más información sobre Lighting, Transparency, and Shading en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
