¿Cómo eliminar Points o Smooth Legend para Graph Builder usando JSL?Hola,
Por defecto, si hay puntos y una línea de suavizado en Graph Builder, hay leyendas para ambos. A veces, tener dos leyendas es redundante y me gustaría deshacerme de una. ¿Cuál es la sintaxis de esto?
Hice una función de creación de gráficos (ver más abajo). Pero parece que no puedo eliminar la Leyenda incluso si pongo Leyenda (0) en Puntos.
//Variable //Definition
//listin ==> list object which contains the following arguments:
//1. Ncol for Line Up Box output
//2. Frame size length
//3. Frame size height
//4. X axis column
// 5+. Y axis columns
// grp ==> grouping variable for X
//ovl ==> grouping variable for overlay (fitting)
// plotout ==> line up box object output
dgbplot = Function({listin,grp,ovl},{plotout},
plotout=Lineup Box(N Col(listin[1]),);
For (i=5, i<=Nitems(listin), i++,
gb = Graph Builder(
Size( Eval(listin[2]), Eval(listin[3]) ),
Show Control Panel( 0 ),
Variables(
X( Column(Eval(listin[4]))),
Y( Column(Eval(listin[i]))),
Group X(Column(grp)),
Overlay(Column(ovl))
),
Elements( Points( X, Y ), Smoother( X, Y, Legend(0), Lambda(5))),
);
gbr = gb << report;
);
plotout;
);Por otro lado, intenté hacer un script de "prueba" y hace lo que quiero. No puedo entender por qué.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Graph Builder(
Size( 960, 300 ),
Show Control Panel( 0 ),
Variables(
X( :weight ),
Y( :height ),
Group X( :sex ),
Overlay( :sex )
),
Elements(
Points( X, Y, ),
Smoother( X, Y, Lambda( 5 ) )
)
)
Gracias,
Shaira
Re: ¿Cómo eliminar Points o Smooth Legend para Graph Builder usando JSL?Creo que su función tenía un problema con lo que estaba devolviendo. Su elemento "plotout" estaba siendo definido dentro de la función como:
plotout=Lineup Box(N Col(listin[1]),);
Este es un objeto completado, que contiene un cuadro de alineación vacío. Nada más en la función se suma a ella. Sin embargo, es el elemento que especifica que debe devolverse desde la función. El siguiente script generará los gráficos que desee. Tenga en cuenta el simple cambio en la función, que incorpora el código del generador de gráficos dentro de la caja de alineación ()
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dgbplot = Function( {listin, grp, ovl},
{plotout},
plotout = Lineup Box( N Col( listin[1] ),
For( i = 5, i <= N Items( listin ), i++,
gb = Graph Builder(
Size( Eval( listin[2] ), Eval( listin[3] ) ),
Show Control Panel( 0 ),
Variables(
X( Column( Eval( listin[4] ) ) ),
Y( Column( Eval( listin[i] ) ) ),
Group X( Column( grp ) ),
Overlay( Column( ovl ) )
),
Elements( Points( X, Y ), Smoother( X, Y, Legend( 0 ), Lambda( 5 ) ) )
// uncomment the lines below to remove smoother legend and keep points
/*,SendToReport(
Dispatch(
{},
"400",
LegendBox,
{Legend Position( {2, [0, 1], 1, [-1, -1]} ), Position( {0, 1, -1, -1} )}
)
)*/
);
gbr = gb << report;
)
);
plotout;
);
listin = {1, 960, 300, "weight", "height"};
nw = New Window( "test", vlb = V List Box() );
myplot = dgbplot( listin, "sex", "sex" );
vlb << append( myplot );