Comment supprimer des points ou une légende lisse pour Graph Builder à l'aide de JSL ?Salut,
Par défaut, s'il y a des points et une ligne de lissage dans Graph Builder, il y a des légendes pour les deux. Parfois, avoir deux légendes est redondant et j'aimerais m'en débarrasser. Quelle est la syntaxe pour cela ?
J'ai créé une fonction de création de graphes (voir ci-dessous). Mais je n'arrive pas à supprimer la légende même si je mets Légende (0) dans Points.
//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;
);D'un autre côté, j'ai essayé de faire un script "d'essai" et ça fait ce que je veux. Je ne comprends pas pourquoi.
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 ) )
)
)
Merci,
Shaira
Re : Comment supprimer des points ou une légende lisse pour le générateur de graphiques à l'aide de JSL ?Je crois que votre fonction avait un problème avec ce qu'elle renvoyait.Votre élément "plotout" était défini dans la fonction comme :
plotout=Lineup Box(N Col(listin[1]),);
Il s'agit d'un objet terminé, qui contient une boîte de ligne vide.Rien d'autre dans la fonction n'y ajoute rien.Cependant, c'est l'élément que vous spécifiez qui doit être renvoyé par la fonction.Le script ci-dessous générera les tracés que vous souhaitez.Veuillez noter le simple changement dans la fonction, qui intègre le code Graph Builder à l'intérieur de la Lineup Box()
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 );