Borrar filtros
Borrar filtros

How to make space underneath the lines white opaque in 3D plot?

1 visualización (últimos 30 días)
I need to fill below the lines in opaque white so that it does not show lines behind. I tried to use the surf command but it does not work.
Here is my code until now:
[xn,yn] = meshgrid(linspace(0,0.5,14),linspace(-15,15,100));
zn = exp(-2*yn.^2).*xn;
xn = xn(:);
yn = yn(:);
zn = zn(:);
%%%%%%%%%%%%%%%%%%%%
index = find(diff(yn)<0);
zn(index) = nan;
%%%%%%%%%%%%%%%%%%%%%
len = index(1);
index = [0;index]+1;
index = index(1:2:end); % every 3rd line -- change to select how many lines to plot
elems = ((0:len) + index).'; % implicit singleton expansion
elems = elems(:);
xn = xn(elems);
yn = yn(elems);
zn = zn(elems);
plot3(xn,yn,zn)
set(gca,'ylim',[-10,10],'zlim',[0,2]);
box off
campos([-2.3393; -134.9790; -2.2455])

Respuesta aceptada

Star Strider
Star Strider el 21 de Jul. de 2018
A relatively simple way is to use the patch function:
[xn,yn] = meshgrid(linspace(0,0.5,14),linspace(-15,15,100));
zn = exp(-2*yn.^2).*xn;
figure
patch(xn,yn,zn,'w', 'EdgeColor','none')
hold on
plot3(xn,yn,zn,'b')
hold off
set(gca,'ylim',[-10,10],'zlim',[0,2]);
box off
campos([-2.3393; -134.9790; -2.2455])
view(45,15)

Más respuestas (0)

Categorías

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

Etiquetas

Productos


Versión

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by