How to fill planes in a 3d Plot?
18 次查看(过去 30 天)
显示 更早的评论
Hi
I have a plot3 with several graphs in it and i want to fill the planes between the graphs and the y axis. I tried fill3 but that doesn't seem to work. Any help would be appreciated!
Cheers
Jan
0 个评论
回答(1 个)
Matt Sprague
2018-1-11
The fill3 command can be used to create the surface between your line and the y-axis. The fliplr command is used to make sure the surface vertices are in the correct order. Here's a small example for an arbitrary line.
% Original Line
x1 = linspace(0,pi/2,10);
y1 = linspace(0,pi/2,10);
z1 = sin(linspace(0,pi/2,10));
%
% Y-Axis
x2 = zeros(size(x1));
y2 = y1;
z2 = zeros(size(x1));
%
% Surface between lines
xs = [x1 fliplr(x2)];
ys = [y1 fliplr(y2)];
zs = [z1 fliplr(z2)];
%
figure(1)
plot3(x1,y1,z1,x2,y2,z2)
hold on
fill3(xs,ys,zs,'r','FaceAlpha',0.5);
grid on
xlabel('X axis')
ylabel('Y axis')
zlabel('Z axis')
hold off
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!