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

4 次查看(过去 30 天)
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])

采纳的回答

Star Strider
Star Strider 2018-7-21
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)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

产品


版本

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by