我想了解如何排列图表。
当用户想要将它们排列成两行,每行三个图表时,我可以使用以下脚本实现:
New Window( "Test",
H List Box(
For( i = 1, i < 4, i++,
Graph Builder(
Size( 528, 450 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :height ) ),
Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) )
)
),
),
H List Box(
For( i = 1, i < 4, i++,
Graph Builder(
Size( 528, 450 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :height ) ),
Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) )
)
),
)
);
但是,当我使用 for 循环时,无法实现相同的效果,如下所示:
New Window( "Test",
For( k = 1, k < 3, k++,
H List Box(
For( i = 1, i < 4, i++,
Graph Builder(
Size( 528, 450 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :height ) ),
Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) )
)
)
)
)
);
我应该修改什么才能使 for 循环的输出正确显示图形?
我建议您使用 Lineup Box(N Col(3)) 而不是 H List Boxes
编辑:
这是一个简单的例子
Names Default To Here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
lub = Lineup Box(N Col(3));
For(i = 1, i <= 10, i++,
lub << Append(
dt << Graph Builder(
Show Control Panel(0),
Variables(X(:weight), Y(:height), Overlay(:sex)),
Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
);
)
);
nw = New Window("report",
lub
);