Plot “如何对抗”;“儿童”;在SciLab?

Plot “如何对抗”;“儿童”;在SciLab?,plot,scilab,graphic,Plot,Scilab,Graphic,我是从Matlab到Scilab的新手 有人能告诉我,如何让孩子们站起来吗 什么意思 gca()。子项 gca().children.children gca().children.children(1) gca().儿童(1).儿童 我们如何知道哪些属性属于儿童 例如gca().children(1).children(1).color=…//不存在 我现在很困惑。。提前感谢让我们通过嵌套图形对象的子属性对其进行模式化 我们有 clc x = [1:1:10]; y1 = x; y2 =

我是从Matlab到Scilab的新手

有人能告诉我,如何让孩子们站起来吗

什么意思

gca()。子项

gca().children.children

gca().children.children(1)

gca().儿童(1).儿童

我们如何知道哪些属性属于儿童

例如gca().children(1).children(1).color=…//不存在


我现在很困惑。。提前感谢

让我们通过嵌套图形对象的子属性对其进行模式化

我们有

clc
 x = [1:1:10];
 y1 = x;
 y2 = 2*x;
 y3 = 3*x;
 plot2d(x,y1);
 plot2d(x,y2);
 plot2d(x,y3)


gca().children(1).children(1).thickness = 2
gca().children(2).children(1).thickness = 7
gca().children(3).children(1).thickness = 4
由于gca是一个函数,因此让我们执行
a=gca()
,因为
gca()。子项将引发错误,因为scilab不理解您正在尝试访问其返回值的字段

  • gca()
    将手柄返回到当前图形的轴:
    a
  • a.children
    返回这些轴的所有子级的句柄数组:<代码>c1、c2、c3
  • a.children.children
    返回上述对象的所有子对象的句柄数组:
    p1、p2、p3
  • a.children.children(1)
    返回
    c1、c2、c3
    p1
  • a.children(1).children
    返回当前轴(c1)的第一个子元素的所有子元素。因为只有一个:
    p1
  • 访问实体的值

    选择一个临时变量:

    figure (f)
    - axes (a)
      - compound1 (c1)
        - polyline (p1)
      - compound2 (c2)
        - polyline (p2)
      - compound3 (c3)
        - polyline (p3)
    
    或者使用
    get

    a = gca();
    idcolor=a.children(1).children(1).foreground // gives the color of a.c1.p1
    
    供参考
    gce()
    命令返回上次创建的对象的句柄。plot2d是一个化合物,所以我们需要找到它的孩子

    您可以将程序重写为

    // idcolor is an array , with idcolor(i) the color of pi
    idcolor = get(get(get(gca(),'children'),'children'),'foreground') 
    
    clc
    x = [1:1:10];
    y1 = x;
    y2 = 2*x;
    y3 = 3*x;
    plot2d(x,y1);
    e1 = get(gce(),'children');
    plot2d(x,y2);    
    e2 = get(gce(),'children');
    plot2d(x,y3)
    e3 = get(gce(),'children');
    e1.thickness = 2
    e2.thickness = 7
    e3.thickness = 4