圖形生成器元素循環函數如何使用循環函數定義多個位置?
如果像下面這樣分開它就可以工作:
Eval(
Substitute(
Expr(
gb = cdt << Graph Builder(
Size( 600, 800 ),
Show Control Panel( 0 ),
vvv,
Elements(Position( 1, 1 ),
Points( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 3 ) ),
Smoother( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 4 ) )
),
Elements(
Position( 2, 1 ),
Box Plot( X, Y, Outliers( 0 ) ),
Points( X, Y ),
Bar( X, Y, Bar Style( "Float" ), Label( "Label by Value" ) ),
Legend( 6 )
),
Elements(
Position( 2, 2 ),
Box Plot( X, Y, Outliers( 0 ) ),
Points( X, Y ),
Bar( X, Y, Bar Style( "Float" ), Label( "Label by Value" ) ),
Legend( 7 )
),
Elements(
Position( 2, 3 ),
Box Plot( X, Y, Outliers( 0 ) ),
Points( X, Y ),
Bar( X, Y, Bar Style( "Float" ), Label( "Label by Value" ) ),
Legend( 8 )
)
)
),
Expr( vvv ),
Name Expr( var expr )
)
);但是如果像這樣使用循環,它就只有長條圖,那麼這段程式碼中缺少什麼?
Eval(
Substitute(
Expr(
gb = cdt << Graph Builder(
Size( 600, 800 ),
Show Control Panel( 0 ),
vvv,
Elements(Position( 1, 1 ),
Points( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 3 ) ),
Smoother( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 4 ) )
),
For( j = 1, j <= n_mydatecol, j++,
Elements(
Position( 2, j ),
Box Plot( X, Y, Outliers( 0 ) ),
Points( X, Y ),
Bar( X, Y, Bar Style( "Float" ), Label( "Label by Value" ) ),
Legend(eval( 5 + j ))
),
),
)
),
Expr( vvv ),
Name Expr( var expr )
)
);
自動化和腳本視窗回覆:圖形產生器元素循環函數您可以單獨建立元素表達式,然後在圖形建構器表達式中進行評估。或者在某些情況下,如果你使用<<添加元素可能會更容易
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = Graph Builder(Variables(X(:height), Y(:weight)), Elements(Points(X, Y), Smoother(X, Y)));
Wait(0.5);
gb << Add Element(1, 1, {Type("Line Of Fit"), X, Y, Degree("Quadratic")});回覆:圖形產生器元素循環函數我的圖表想要這樣,需要定義位置嗎?

回覆:圖形產生器元素循環函數添加元素確實允許您設定 X 和 Y 位置。您是否嘗試過它是否適合您的用例?
回覆:圖形產生器元素循環函數你好,Jarmo,
嘗試使用下面的程式碼,但仍然只顯示箱線圖,我該如何顯示長條圖和標籤。

Eval(
Substitute(
Expr(
gb = cdt << Graph Builder(
Size( 1200, 800 ),
Show Control Panel( 0 ),
vvv,
Elements(
Position( 1, 1 ),
Points( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 3 ) ),
Smoother( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 4 ) )
)
);
// Loop to add repetitive elements
For( i = 2, i <= 10, i++,
gb << Add Elements(
Position( 2, i ),
Box Plot( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 2 * i + 1 ) ),
Bar( X, Y, Legend( 2 * i + 2 ), Bar Style( "Float" ), Label( "Label by Value" ), Label Format( "Fixed Dec", 5, 2 ) )
);
);
),
Expr( vvv ),
Name Expr( var expr )
)
);
回覆:圖形產生器元素循環函數我必須建立範例資料(或找到合適的資料)並重新建立圖表,因此這將需要一些時間
回覆:圖形產生器元素循環函數我可以看到所有圖像都變成了和之前完全不同的樣子...我不確定所提供的腳本與這些新圖像的對應程度如何。哪些列需要動態新增以及新增在哪裡?
圖形產生器腳本

看起來像這樣
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(528, 454),
Show Control Panel(0),
Variables(X(:height), X(:sex), Y(:weight)),
Elements(
Position(1, 1),
Points(X, Y, Legend(5)),
Smoother(X, Y, Legend(6)),
Line Of Fit(X, Y, Legend(8))
),
Elements(
Position(2, 1),
Points(X, Y, Legend(18)),
Bar(X, Y, Legend(19), Bar Style("Float"), Label("Label by Value"))
)
);
如果你有這樣的情節,並希望在右側添加有點的浮動條形圖

您可以使用新增元素
gb << Add Element(2, 1, {Type("Bar"), X, Y, Bar Style("Float"), Label("Label by Value")});
看更多...
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(528, 454),
Show Control Panel(0),
Variables(X(:height), X(:sex), Y(:weight)),
Elements(
Position(1, 1),
Points(X, Y, Legend(5)),
Smoother(X, Y, Legend(6)),
Line Of Fit(X, Y, Legend(8))
),
Elements(
Position(2, 1),
Points(X, Y, Legend(18))
)
);
gb << Add Element(2, 1, {Type("Bar"), X, Y, Bar Style("Float"), Label("Label by Value")});
回覆:圖形產生器元素循環函數你好,Jarmo,
感謝您的幫助,如果 y 軸只有一個,它可以工作,但我想要的是如果它們有多個 y 軸,我仍然可以使用循環函數來獲得帶有箱線圖和條形圖的元素嗎?我曾經嘗試過第一個,但它只顯示箱線圖而沒有長條圖。
回覆:圖形產生器元素循環函數我不確定你在策劃什麼,但它可能會(或可能不會)起作用。這裡我使用新增元素將長條圖加入 X 軸 2 和 Y 軸 1 和 2
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(528, 454),
Show Control Panel(0),
Variables(X(:height), X(:sex), Y(:name), Y(:weight)),
Elements(Position(1, 1), Points(X, Y, Legend(20))),
Elements(
Position(1, 2),
Points(X, Y, Legend(5)),
Smoother(X, Y, Legend(6)),
Line Of Fit(X, Y, Legend(8))
),
Elements(Position(2, 1), Points(X, Y, Legend(19))),
Elements(Position(2, 2), Points(X, Y, Legend(18)))
);
gb << Add Element(2, 1, {Type("Bar"), X, Y, Bar Style("Float"), Label("Label by Value")});
gb << Add Element(2, 2, {Type("Bar"), X, Y, Bar Style("Float"), Label("Label by Value")});

回覆:圖形產生器元素循環函數它有效,我就是這樣嘗試的。
多謝
Eval(
Substitute(
Expr(
gb = cdt << Graph Builder(
Size( 600, 800 ),
Show Control Panel( 0 ),
vvv,
Elements(Position( 1, 1 ),
Points( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 3 ) ),
Smoother( X, Y( 1 ), Y( 2 ), Y( 3 ), Legend( 4 ) )
),
);
For( i = 1 , i <= n_mymetric , i++,
gb << Add Element(2, i, {Type("Bar"), X, Y, Bar Style("Float"), Label("Label by Value")});
),
),
Expr( vvv ),
Name Expr( var expr )
)
);