[Script JLS]:循环绘制多个图形你好,
我是 JMP 的新手。 这是一个功能强大的软件!
这就是为什么我想编写一个脚本,可以在一个 X 的函数中绘制来自不同列(实际上每 n 列)的几个 Y。
由于图形生成器界面,我写了它,但我想在一个循环中编写它的脚本。
我做了类似的事情来绘制分布(但不幸的是它不是相同的比例......)
//Distributions Std Dev
New Window( "Side by Side",
H List Box(
Distribution(
Continuous Distribution( Column( :median_range_mm ))
);
for ( p = 2, p <= 64, p++,
nom = "median_range_mm " || char(p);
col = Column(nom);
Distribution(
Continuous Distribution( Column( col ), Std Error Bars( 1 ) );
/*SendToReport(
Dispatch(
{"Distributions", Column( col )},
"1",
ScaleBox,
{Min( 1450 ), Max( 1820 ), Inc( 20 ), Minor Ticks( 0 ),
Label Row Nesting( 1 )}
)
)*/
)
)
)
这是我尝试解决我的主要问题的方法,结果只是一个打开的图形生成器窗口。
我想在 Y 轴上绘制列 [ref, ref 1 , ref 2 until ref 64] 并在 X 轴上绘制 currentTimeMillis
New Window( "Ref",
H List Box(
Graph Builder(
For (r = 2 , r <= 64, r++,
name = "ref " || char(r);
col = Column(name);
Variables( X( :currentTimeMillis ), Y (Column (col), Position( 1 ) ) ),
Elements(
Points( X, Y(r) , Legend( 29 ) ),
Smoother( X , Y(r), Legend( 30 ) )
),
SendToReport(
Dispatch(
{},
"graph title",
TextEditBox,
{Set Text( strTitle )}
)
)
)
)
)
);感谢您的帮助。
干杯
回复:[Script JLS]:用于一起绘制多个图形的循环可以很容易地创建输出对象,这些对象可以预先创建,然后根据用户的请求显示。或者,由于 JMP 的速度,我的许多应用程序都会在用户请求时生成特定的输出。您还应该探索 Column Switcher,它允许用户从列表中选择要分析和显示的列。
回复:[Script JLS]:用于一起绘制多个图形的循环是否可以保存单个图形(如轻松访问列表)供以后使用,而不是将它们全部绘制在一个 H 列表框中?谢谢。
回复:[Script JLS]:用于一起绘制多个图形的循环我有点困惑.....但我提供此代码作为解决方案的可能示例。从您提供的最后一段代码看来,您正在将数据表中的列名称更改为“Ref”。由于 JMP 不允许您有 2 个同名的列,因此您尝试重命名为“Ref”的第二列实际上被命名为“Ref 2”。这一直持续到“Ref 64”列。我还建议您重新检查您的代码以了解列“currentTimeMillis”的命名。在您的代码中,您实际上将该列重命名(同名)64 次。
下面是我的新代码......它使用了一个样本数据表......名为 Ref - Ref 64 的列都是连续的,但由于 JMP 真的不关心,代码将也适用于您的数据表,其中的列分布在 700 多列中
Names Default To Here( 1 );
// Build some sample data
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
Column( dt, 6 ) << set name( "ref" );
For( i = 7, i <= 69, i++,
Column( dt, i ) << set name( "ref " || Char( i - 5 ) )
);
Column( dt, 5 ) << set name( "currentTimeMillis" );
// Build the JSL code for the Graph Builder
theExpr = "dt << Graph Builder(
Variables(
X( :currentTimeMillis ),
Y( :ref )";
For( i = 2, i <= 64, i++,
theExpr = theExpr || ",Y( :ref " || Char( i ) || ", Position( 1 ) )"
);
theExpr = theExpr || "),
Elements(
Points(
X";
For( i = 2, i <= 64, i++,
theExpr = theExpr || ",Y( " || Char( i ) || ")"
);
theExpr = theExpr || "
,Legend( 5 )
),
Smoother(
X";
For( i = 2, i <= 64, i++,
theExpr = theExpr || ",Y( " || Char( i ) || ")"
);
theExpr = theExpr || " ,
Legend( 6 )
)
)
)";
// Execute the generated code
Eval( Parse( theExpr ) );
回复:[Script JLS]:用于一起绘制多个图形的循环谢谢你的回复吉姆!
但我可能歪曲了我的问题。
确实,我想拥有我所有的情节都在同一张图上.
此外,我的 Y 列已经每 11 列设置一次,并且 currentTimeMillis 在开始时只出现一次:
//Set columns
For( i = 1, i <=709 , i++,
For ( j = 0, j <= 63, j++,
If ( i == 2, Column(i) << set name( "currentTimeMillis" ),i == 15 + 11*j, Column(i) << set name( "ref" ),
)
)
)最后,"__col__" 还没有被定义("col" 被定义了,但是在另一个用于分发的函数中),所以我不明白你为什么在这里使用它。
再次感谢。
回复:[Script JLS]:用于一起绘制多个图形的循环这是我将如何做的一个例子
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
For( i = 6, i <= 69, i++,
Column( dt, i ) << set name( "ref " || Char( i - 5 ) )
);
Column( dt, 5 ) << set name( "currentTimeMillis" );
New Window( "Ref",
hlb = H List Box(
)
);
For( r = 2, r <= 64, r++,
name = "ref " || Char( r );
Eval(
Substitute(
Expr(
outputhlb = H List Box(
Graph Builder(
Variables(
X( :currentTimeMillis ),
Y( Column( __col__ ), Position( 1 ) )
),
Elements(
Points( X, Y( r ), Legend( 29 ) ),
Smoother( X, Y( r ), Legend( 30 ) )
),
SendToReport(
Dispatch(
{},
"graph title",
TextEditBox,
{Set Text( strTitle )}
)
)
)
)
),
Expr( __col__ ), Parse( ":" || name )
)
);
hlb << append( outputhlb );
);