Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在matlab中设置子图的位置_Matlab_Plot - Fatal编程技术网

如何在matlab中设置子图的位置

如何在matlab中设置子图的位置,matlab,plot,Matlab,Plot,我试图一个接一个地设置此子地块,但无法更改它们的位置。我能做什么 figure subplot(10,1,1,'Position',[0.5,0.69,1,0.1]);plot(B{1, 1}(:,[1,3]),'Color', [0,0,0]);legend('Black'); subplot(10,1,2,'Position',[0.5,0.37,1,0.1]);plot(B{2, 1}(:,[1,3]),'Color', [1,0,0]);legend('Red'); subplot(

我试图一个接一个地设置此子地块,但无法更改它们的位置。我能做什么

figure
subplot(10,1,1,'Position',[0.5,0.69,1,0.1]);plot(B{1, 1}(:,[1,3]),'Color', 
[0,0,0]);legend('Black');
subplot(10,1,2,'Position',[0.5,0.37,1,0.1]);plot(B{2, 1}(:,[1,3]),'Color', 
[1,0,0]);legend('Red');
subplot(10,1,3,'Position',[0,0,1,0.1]);plot(B{3, 1}(:,[1,3]),'Color', 
[0,1,0]);legend('Lime');
subplot(10,1,4,'Position',[0,0,1,0.1]);plot(B{4, 1}(:,[1,3]),'Color', 
[0,0,1]);legend('Blue');
subplot(10,1,5,'Position',[0,0,1,0.1]);plot(B{5, 1}(:,[1,3]),'Color', 
[0,1,1]);legend('Cyan');
subplot(10,1,6,'Position',[0,0,1,0.1]);plot(B{6, 1}(:,[1,3]),'Color', 
[1,0,1]);legend('Magenta');
subplot(10,1,7,'Position',[0,0,1,0.1]);plot(B{7, 1}(:,[1,3]),'Color', 
[0.5,0.5,0.5]);legend('Gray');
subplot(10,1,8,'Position',[0,0,1,0.1]);plot(B{8, 1}(:,[1,3]),'Color', 
[0.5,0,0]);legend('Maroon');
subplot(10,1,9,'Position',[0,0,1,0.1]);plot(B{9, 1}(:,[1,3]),'Color', 
[0.5,0,0.5]);legend('Purple');
subplot(10,1,10,'Position',[0,0,1,0.1]);plot(B{10, 1}(:,[1,3]),'Color', 
[0,0.5,0.5]);legend('Teal');

如果要手动设置其位置,只需直接创建轴对象:

figure
axes('Position',[0.5,0.69,1,0.1]);plot(B{1, 1}(:,[1,3]),'Color', 
[0,0,0]);legend('Black');
axes('Position',[0.5,0.37,1,0.1]);plot(B{2, 1}(:,[1,3]),'Color', 
[1,0,0]);legend('Red');


子地块的好处在于它为您放置轴。它没有其他用途

如果要手动设置其位置,只需直接创建轴对象:

figure
axes('Position',[0.5,0.69,1,0.1]);plot(B{1, 1}(:,[1,3]),'Color', 
[0,0,0]);legend('Black');
axes('Position',[0.5,0.37,1,0.1]);plot(B{2, 1}(:,[1,3]),'Color', 
[1,0,0]);legend('Red');


子地块的好处在于它为您放置轴。它没有其他用途

好吧,你可以改变位置,只要你做得好

如中所述,您可以指定位置:

自动地 利用

subplot(m,n,p)
在p位置使用m x n栅格打印。这是您部分使用的

人工 利用

subplot('Position',[left bottom width height])      
这就是你的问题所在。正如手册中所述,如果重叠,将删除下面的图形。 在您的例子中,有几个位置是重叠的。 还要注意的是,位置始终是标准化的,因此左=0.5,宽度=1意味着您在x方向裁剪了图形的一半。使用手动定位时请注意。 如前所述,可以直接使用axis。这有几个优点和缺点。但是,轴中的单位也被归一化。所以,知道你在用什么


当您同时使用手动和自动设置时,我不清楚哪一个会有首选项,因为我在测试代码的一部分时得到了不同的输出

好吧,你可以改变位置,只要你做得好

如中所述,您可以指定位置:

自动地 利用

subplot(m,n,p)
在p位置使用m x n栅格打印。这是您部分使用的

人工 利用

subplot('Position',[left bottom width height])      
这就是你的问题所在。正如手册中所述,如果重叠,将删除下面的图形。 在您的例子中,有几个位置是重叠的。 还要注意的是,位置始终是标准化的,因此左=0.5,宽度=1意味着您在x方向裁剪了图形的一半。使用手动定位时请注意。 如前所述,可以直接使用axis。这有几个优点和缺点。但是,轴中的单位也被归一化。所以,知道你在用什么


当您同时使用手动和自动设置时,我不清楚哪一个会有首选项,因为我在测试代码的一部分时得到了不同的输出

关于OP使用的坐标有一个很好的观点。8个轴得到相同的位置,这不可能是正确的。OP使用的坐标很好。8个轴的位置相同,这不可能正确。