如何使用 JSL 删除 Graph Builder 的点或平滑图例?你好,
默认情况下,如果 Graph Builder 中有点和平滑线,则两者都有图例。 有时,拥有两个传奇是多余的,我想摆脱一个。 这个的语法是什么?
我制作了一个图形构建器功能(见下文)。 但是,即使我将 Legend (0) 放在 Points 中,我似乎也无法删除 Legend。
//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;
);另一方面,我尝试制作一些“试用”脚本,它可以满足我的需求。 我不明白为什么。
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 ) )
)
)
谢谢,
沙伊拉
回复:如何使用 JSL 删除 Graph Builder 的点或平滑图例?我相信您的函数返回的内容有问题。您的“plotout”元素被定义为:
plotout=Lineup Box(N Col(listin[1]),);
这是一个完整的对象,其中包含一个空的阵容框。函数中没有其他任何东西可以增加它。但是,应该从函数返回的是您指定的元素。下面的脚本将生成您想要的图。请注意函数中的简单更改,它在 Lineup Box() 中合并了 Graph Builder 代码
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 );