i plotted a 3d plot with the following code, but with my own measured data:
我使用以下代码绘制了一个3d图,但是使用了我自己的测量数据:
Data = rand(1000, 4); % 4 Channels or more or less
Time = 1:1000;
sData = size(Data);
vSignal = 1:sData(2);
plot3(Time, vSignal(ones(1, sData(1)), :), Data);
view(-150, 60)`
Now I want to fill under the graphes I plotted.But it´s really important for me to be able to plot and fill below multiple graphes! Do I have to use fill3()? I imported my data as a numeric matrix. I tried several ways but I failed. Thanks for help.
现在我想填写我绘制的图表。但是对于我来说,能够在多个图形下方进行绘图和填充是非常重要的!我必须使用fill3()吗?我将数据导入为数字矩阵。我尝试了几种方法,但我失败了。感谢帮助。
1 个解决方案
#1
1
Here is how to use fill3
:
以下是如何使用fill3:
for ii = 1:sData(2)
fill3([Time,Time(end),Time(1)],ii*ones(1,size(Time,2)+2),[Data(:,ii);zeros(2,1)],ii*ones(2+size(Time,2),1),'EdgeColor','none');
end
I use the for
loop since I create a patch for each plot separately (I call the filled-in area a Patch). For each patch, I need to give its boundaries, and fill3
will fill everything in between. The boundaries are the exact points that you used in plot3
, but in addition you need two more points on the x-y plane to close the patch (to make it a polygon). That is the reason I extend the vectors by 2.
我使用for循环,因为我分别为每个绘图创建一个补丁(我将填充区域称为补丁)。对于每个补丁,我需要给出它的边界,fill3将填充它们之间的所有内容。边界是您在plot3中使用的精确点,但另外您需要在x-y平面上再多两个点来关闭贴片(使其成为多边形)。这就是我将向量扩展2的原因。
#1
1
Here is how to use fill3
:
以下是如何使用fill3:
for ii = 1:sData(2)
fill3([Time,Time(end),Time(1)],ii*ones(1,size(Time,2)+2),[Data(:,ii);zeros(2,1)],ii*ones(2+size(Time,2),1),'EdgeColor','none');
end
I use the for
loop since I create a patch for each plot separately (I call the filled-in area a Patch). For each patch, I need to give its boundaries, and fill3
will fill everything in between. The boundaries are the exact points that you used in plot3
, but in addition you need two more points on the x-y plane to close the patch (to make it a polygon). That is the reason I extend the vectors by 2.
我使用for循环,因为我分别为每个绘图创建一个补丁(我将填充区域称为补丁)。对于每个补丁,我需要给出它的边界,fill3将填充它们之间的所有内容。边界是您在plot3中使用的精确点,但另外您需要在x-y平面上再多两个点来关闭贴片(使其成为多边形)。这就是我将向量扩展2的原因。