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术语:为什么要将父对象用于Axis?_Matlab_Plot_Parent Child_Terminology - Fatal编程技术网

MATLAB术语:为什么要将父对象用于Axis?

MATLAB术语:为什么要将父对象用于Axis?,matlab,plot,parent-child,terminology,Matlab,Plot,Parent Child,Terminology,这是一个关于MATLAB中父应用程序的MATLAB术语问题。我经常在绘图中使用axes1=axes‘Parent’,如图1所示,因为我已经记住了绘图步骤。但我甚至不明白我为什么用这句话 我知道Matlab图形中有父对象和子对象。然而,我认为父对象只适用于图形,所有其他图形对象都在下面。父对象是什么意思?我们应用为:axes1=axes‘Parent’,如图1所示。父对象是MATLAB中一个axes对象或许多其他图形对象的属性,它存储对象父对象的句柄 用于创建轴对象的语法是轴的重载: axesNa

这是一个关于MATLAB中父应用程序的MATLAB术语问题。我经常在绘图中使用axes1=axes‘Parent’,如图1所示,因为我已经记住了绘图步骤。但我甚至不明白我为什么用这句话

我知道Matlab图形中有父对象和子对象。然而,我认为父对象只适用于图形,所有其他图形对象都在下面。父对象是什么意思?我们应用为:axes1=axes‘Parent’,如图1所示。

父对象是MATLAB中一个axes对象或许多其他图形对象的属性,它存储对象父对象的句柄

用于创建轴对象的语法是轴的重载:

axesName,Value使用一个或多个名称-值对参数修改轴的外观或控制数据的显示方式。例如,“FontSize”,14设置轴文本的字体大小

参考:

因此,axes1=axes‘Parent’,图1创建一个axes对象,并将图1指定给其父属性。通过这样做,轴被放置在图1中

当您有多个图形窗口并且希望将轴添加到非最顶部的特定图形时,这是必需的。例如:

figure1 = figure;
figure2 = figure;

% Now you have two figure windows and you only want to add an axes to figure1.
% Note that figure2 is the topmost figure since it is created at a later time.
axes1 = axes('Parent', figure1);
figure1 = figure;
figure2 = figure;

% add a new axes to figure2.
axes1 = axes;
figure('Color',[0 0 0], ....
              'Position', [0 0 100 100]);

scatter(x,y,'MarkerEdgeColor',[0 .5 .5],...
              'MarkerFaceColor',[0 .7 .7],...
              'LineWidth',1.5);

如果只有一个图形窗口,或者图形窗口需要一个新的轴位于最顶端,则可以简单地键入轴。例如:

figure1 = figure;
figure2 = figure;

% Now you have two figure windows and you only want to add an axes to figure1.
% Note that figure2 is the topmost figure since it is created at a later time.
axes1 = axes('Parent', figure1);
figure1 = figure;
figure2 = figure;

% add a new axes to figure2.
axes1 = axes;
figure('Color',[0 0 0], ....
              'Position', [0 0 100 100]);

scatter(x,y,'MarkerEdgeColor',[0 .5 .5],...
              'MarkerFaceColor',[0 .7 .7],...
              'LineWidth',1.5);

有关语法的更多信息

这种语法在MATLAB中并不少见。例如:

figure1 = figure;
figure2 = figure;

% Now you have two figure windows and you only want to add an axes to figure1.
% Note that figure2 is the topmost figure since it is created at a later time.
axes1 = axes('Parent', figure1);
figure1 = figure;
figure2 = figure;

% add a new axes to figure2.
axes1 = axes;
figure('Color',[0 0 0], ....
              'Position', [0 0 100 100]);

scatter(x,y,'MarkerEdgeColor',[0 .5 .5],...
              'MarkerFaceColor',[0 .7 .7],...
              'LineWidth',1.5);

父对象是MATLAB中Axis对象或许多其他图形对象的属性,它存储对象父对象的句柄

用于创建轴对象的语法是轴的重载:

axesName,Value使用一个或多个名称-值对参数修改轴的外观或控制数据的显示方式。例如,“FontSize”,14设置轴文本的字体大小

参考:

因此,axes1=axes‘Parent’,图1创建一个axes对象,并将图1指定给其父属性。通过这样做,轴被放置在图1中

当您有多个图形窗口并且希望将轴添加到非最顶部的特定图形时,这是必需的。例如:

figure1 = figure;
figure2 = figure;

% Now you have two figure windows and you only want to add an axes to figure1.
% Note that figure2 is the topmost figure since it is created at a later time.
axes1 = axes('Parent', figure1);
figure1 = figure;
figure2 = figure;

% add a new axes to figure2.
axes1 = axes;
figure('Color',[0 0 0], ....
              'Position', [0 0 100 100]);

scatter(x,y,'MarkerEdgeColor',[0 .5 .5],...
              'MarkerFaceColor',[0 .7 .7],...
              'LineWidth',1.5);

如果只有一个图形窗口,或者图形窗口需要一个新的轴位于最顶端,则可以简单地键入轴。例如:

figure1 = figure;
figure2 = figure;

% Now you have two figure windows and you only want to add an axes to figure1.
% Note that figure2 is the topmost figure since it is created at a later time.
axes1 = axes('Parent', figure1);
figure1 = figure;
figure2 = figure;

% add a new axes to figure2.
axes1 = axes;
figure('Color',[0 0 0], ....
              'Position', [0 0 100 100]);

scatter(x,y,'MarkerEdgeColor',[0 .5 .5],...
              'MarkerFaceColor',[0 .7 .7],...
              'LineWidth',1.5);

有关语法的更多信息

这种语法在MATLAB中并不少见。例如:

figure1 = figure;
figure2 = figure;

% Now you have two figure windows and you only want to add an axes to figure1.
% Note that figure2 is the topmost figure since it is created at a later time.
axes1 = axes('Parent', figure1);
figure1 = figure;
figure2 = figure;

% add a new axes to figure2.
axes1 = axes;
figure('Color',[0 0 0], ....
              'Position', [0 0 100 100]);

scatter(x,y,'MarkerEdgeColor',[0 .5 .5],...
              'MarkerFaceColor',[0 .7 .7],...
              'LineWidth',1.5);


没错,你的理解是正确的。该行:

axes1 = axes(‘Parent’, figure1)
在变量axes1下创建一组轴,并指定该组轴的父对象是变量figure1下的图形对象,这可能是您正确猜测的图形


当您同时创建和处理多个图形/轴时,明确指定哪个图形是哪个轴对象的父对象非常有用,这样您就知道哪个图形/轴是哪个了。

没错,您的理解是正确的。该行:

axes1 = axes(‘Parent’, figure1)
在变量axes1下创建一组轴,并指定该组轴的父对象是变量figure1下的图形对象,这可能是您正确猜测的图形


当您同时创建和处理多个图形/轴时,明确指定哪个图形是哪个轴对象的父对象非常有用,这样您就可以知道哪个图形/轴是哪个。

“父对象仅与图形相关,所有其他图形对象都在下面”实际上,每个对象都有一个父对象。图形系统是一个层次结构,其中根对象groot是所有图形的父对象;图形是轴、uicontrol、注释等的父对象。;轴是线、文本等的父对象。;以此类推,“父对象只与图形相关,所有其他图形对象都在下面”实际上,每个对象都有一个父对象。图形系统是一个层次结构,其中根对象groot是所有图形的父对象;图形是轴、uicontrol、注释等的父对象。;轴是线、文本等的父对象。;等等。真是一个很好的解释。真是一个很好的解释。