필터 지우기
필터 지우기

How to fill planes in a 3d Plot?

조회 수: 5 (최근 30일)
Jan Tiede
Jan Tiede 2018년 1월 9일
댓글: Jan Tiede 2018년 1월 13일
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

답변 (1개)

Matt Sprague
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
  댓글 수: 1
Jan Tiede
Jan Tiede 2018년 1월 13일
Hi Matt,
thanks for your answer. I tried to do it with my code but can't seem to produce the filled planes.
Here is how I thought it should be:
if true
%%Fill planes with colour
% Original Line
h = ones(1,26)
%
x1 = h;
y1 = RSTuvw.vw_avg(1,:);
z1 = ADCP.Range;
%
% Y-Axis
x2 = x1;
y2 = zeros(size(y1));
z2 = zeros(size(z1))
%
% 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 end

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by