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 轴特性与';yyaxis';_Matlab_Graphics_Matlab Figure - Fatal编程技术网

Matlab 轴特性与';yyaxis';

Matlab 轴特性与';yyaxis';,matlab,graphics,matlab-figure,Matlab,Graphics,Matlab Figure,使用以下命令创建具有两个y轴的地物: 发现了以下奇怪的行为。这已在Windows 10上的R2017b和R2019a中进行了测试 对象hl和hr似乎属于同一轴(即,yyyaxis不创建新轴): 但是,轴的'children'属性仅反映一个对象: >> get(get(get(hl, 'parent'), 'children'), 'LineStyle') ans = '--' >> get(get(get(hr, 'parent'), 'children'), '

使用以下命令创建具有两个y轴的地物:

发现了以下奇怪的行为。这已在Windows 10上的R2017b和R2019a中进行了测试

对象
hl
hr
似乎属于同一轴(即,
yyyaxis
不创建新轴):

但是,轴
'children'
属性仅反映一个对象:

>> get(get(get(hl, 'parent'), 'children'), 'LineStyle')
ans =
    '--'
>> get(get(get(hr, 'parent'), 'children'), 'LineStyle')
ans =
    '--'
此外,父轴的
YAxisLocation'
属性对于两个对象具有相同的值

>> get(get(hl, 'parent'), 'YAxisLocation')
ans =
    'right'
>> get(get(hr, 'parent'), 'YAxisLocation')
ans =
    'right'
如果现在单击实线,使其成为当前对象

>> get(get(get(gco, 'parent'), 'children'), 'LineStyle')
ans =
    '-'
>> get(get(get(hl, 'parent'), 'children'), 'LineStyle')
ans =
    '-'
>> get(get(get(hr, 'parent'), 'children'), 'LineStyle')
ans =
    '-'
>> get(get(gco, 'parent'), 'YAxisLocation')
ans =
    'left'
同样,如果我们现在点击虚线

>> get(get(get(gco, 'parent'), 'children'), 'LineStyle')
ans =
    '--'
>> get(get(get(hl, 'parent'), 'children'), 'LineStyle')
ans =
    '--'
>> get(get(get(hr, 'parent'), 'children'), 'LineStyle')
ans =
    '--'
>> get(get(gco, 'parent'), 'YAxisLocation')
ans =
    'right'
作为支票

>> get(gcf, 'children')
也只给出一个轴,并且

>> get(get(gcf, 'children'), 'children')
行为类似:仅列出上次打印的对象,或将THA设置为当前对象

上述行为可归纳如下:

  • 只有一个轴(所有对象的
    'parent'
    属性如预期的那样引用该轴)
  • 轴的
    'children'
    属性只列出一个对象,即当前对象或最后打印的对象
  • 轴的
    'YAxisLocation'
    属性在
    'left'
    'right'
    之间动态变化。同样,这是由当前对象或上次打印的对象确定的
不清楚如何理解这种行为。以下问题自然会出现:

  • 这有文件记录吗
  • 两个对象如何可以具有与“父对象”相同的轴,但该轴仅具有当前对象作为“子对象”
  • 为什么
    'YAxisLocation'
    也会根据当前对象的不同而变化

    • 在我看来,yyaxis在幕后做了一些令人讨厌的事情,有很多隐藏的数据我们无法访问

      报告确实说:

      yyaxis left
      激活当前轴与左y轴关联的一侧。后续图形命令以左侧为目标

      对象的
      子对象
      属性仅包含活动侧的子对象。要访问两侧的所有子项,请使用
      allchild
      功能

      使用
      yyaxis
      更改“side”因此会更改
      Axes
      对象的内容,我假设另一侧的内容存储在我无法找到的某个隐藏位置
      yyaxis
      是P-code,因此我们无法确定它到底在做什么

      这很有趣:

      图
      YY轴左
      hl=绘图([010],[01],“-”);
      YY轴右
      hr=绘图([0 10],[100 0],“--”);
      h=gca;
      YY轴左
      h、 叶利姆
      YY轴右
      h、 叶利姆
      
      该代码创建具有不同限制的左轴和右轴。我们得到轴的控制柄,向左,从控制柄读取限制,然后向右,再次读取相同的属性。第一次返回
      [0,1]
      ,第二次返回
      [0100]
      。也就是说,当我们调用
      yyaxis
      时,带有句柄
      h
      Axes
      对象会发生变化

      我发现,
      h
      指向两边的轴的唯一指示是,
      h.YAxis
      NumericRuler
      对象返回两个句柄,每边一个



      我不能不觉得这是一种尴尬的行为。我本以为会有两个
      对象,它们都具有相同的
      位置
      属性,并且可能具有保持这两个轴同步的侦听器。

      来自:“
      yyaxis left
      激活当前轴与左y轴关联的一侧。后续图形命令以左侧为目标。”以及“轴对象的
      子对象
      属性仅包含活动侧的子对象。要访问两侧的所有子项,请使用
      allchild
      功能。所以这是一种记录在案的行为,虽然很尴尬
      yyaxis
      是一个P文件,毫无用处。@CrisLuengo-Aah,因此当前对象确定活动面,该面的句柄被隐藏。活动端还更改
      'YAxisLocation'
      属性。我应该读一下文档:-)想发布一个答案吗?我还在研究这个问题
      get(gca,'YAxis')
      返回一个包含两个值的数组:每边一个标尺。但是
      YAxisLocation
      YLim
      YTick
      等只描述了活动的一面。我越是深入研究这个问题,就越感到困惑。我不确定我在下面键入的答案是否正确,但可能它添加了一些信息。还有一些奇怪的事情:
      allchild(h)
      调用
      getAllchildChildren(h)
      (这是一个m文件)
      getAllchildChildren
      matlab.graphics.axis.axis
      的一种方法<代码>帮助matlab.graphics.axis.axis.getAllchildChildren说:“注释字段的内容应该放在这里。”。。。那很有用!!!
      >> get(gcf, 'children')
      
      >> get(get(gcf, 'children'), 'children')