Hola Comunidad JMP;
En mi búsqueda para automatizar algunas de las tareas más tediosas de las gráficas de anotación Graph Builder, estoy tratando de agregar dinámicamente segmentos de línea horizontal entre grupos de datos usando el siguiente script. Desafortunadamente, parece que no puedo usar Expr () simple seguido de Substitute () y Eval () para esta tarea específica. Nota: estoy trabajando con datos confidenciales, por lo tanto, tendré que crear tablas simuladas de DATOS y STAT si es necesario.
Names Default to Here (1);
dt1 = Data Table ("DATA.JMP");
dt2 = Data Table ("STAT.JMP");
gbe = Expr (dt1 << Graph Builder(
Size( 699, 625 ),
Variables(
X( :R vs NR ),
Y( _YS_ ),
Color( :R vs NR )
),
Elements(
Points( X, Y, Legend( 6 ) ),
Box Plot( X, Y, Legend( 8 ), Outliers( 0 ) )
),
SendToReport(
Dispatch(
{},
"Graph Builder",
FrameBox,
{Add Graphics Script(
2,
Description( "Script" ),
Pen Size (3);
// The following line of code return the error "Invalid Matrix Token"
Line ([0.2,0.8], [Y1, Y1]);
Text( Center Justified, {0.5, top1}, VAL1 );
// The following line of code return the error "Invalid Matrix Token"
Line ([0.2,1.8], [Y2, Y2]);
Text( Center Justified, {1.0, top2}, VAL2 );
// The following line of code return the error "Invalid Matrix Token"
Line ([1.2,1.8], [Y1, Y1]);
Text( Center Justified, {1.5, top1}, VAL3 );
), Grid Line Order( 1 ), Reference Line Order( 3 )}
)
)
)
);
For (i = 749, i <= 750, i++,
YCOL = Column (dt1, i);
PVAL1 = "p VAL = " || CHAR(format(Column (dt2, 2) [i-747],"PValue"));
PVAL2 = "p VAL = " || CHAR(format(Column (dt2, 3) [i-747],"PValue"));
PVAL3 = "p VAL = " || CHAR(format(Column (dt2, 4) [i-747],"PValue"));
data_topy1 = Col Quantile (YCOL, 0.99);
data_topy2 = Col Quantile (YCOL, 0.975);
gbx = Substitute(Name Expr (gbe),
Expr (_YS_), YCOL,
Expr (VAL1), PVAL1,
Expr (VAL2), PVAL2,
Expr (VAL3), PVAL3,
Expr (Y1), data_topy1,
Expr (Y2), data_topy2
);
gb = Eval (gbx);
gb << journal;
gb << close window;
);Cualquier idea sería bienvenida.
Gracias
Su solución es excelente para este caso, ya que HLine y VLine son infinitamente largas. Aquí hay una explicación y algunas alternativas.
La matriz de corchetes es una constante de tiempo de compilación y no puede usar variables. A menudo he usado operadores de concatenación para construir matrices pequeñas como esta:
a = 17;
b = 23;
Show( a || b, a |/ b );
un || b = [17 23];
a |/ b = [17, 23];
También puedes usar matriz():
matrix( {{a, b}, {a, a}} );[17 23, 17 17]
Si su línea necesita estar limitada a 0.2 y 1.8, podría usar una forma diferente de línea que tome listas en lugar de matrices:
line( {x1,y1}, {x2,y2} )La función de línea evalúa las expresiones en cada lista.
Y, si necesita una línea infinitamente larga en algún ángulo que no sea horizontal o vertical, puede usar YFunction():
YFunctionYFunctionFunción Y