在 JSL 的圖形產生器中向變數新增條件大家好,
我正在嘗試修改具有某些變數的圖形生成器程式碼。我想新增條件語句來包含或排除這些某些變數。我嘗試使用 if 語句,但它似乎無法正常工作。我將不勝感激任何有關此事的建議。
範例程式碼:
我想從用戶那裡獲取輸入(已經完成這部分),以評估用戶是否想要針對測試溫度的結果(例如)。我確實有其他變數可以繪製,但我提供了測試溫度來簡化範例。
// x will be taken as an input
Graph Builder(
Size( 1257, 829 ),
Level Spacing Color( "Black" ),
Variables( Y( :TX_EVM ), Y( :TX_EVM ), If( Equal( X, 1 ), Group X( :Test_Temp ) ) ),
Elements( Box Plot( Y, Legend( 19 ) ) ),
Local Data Filter(
Add Filter(
columns( :Test_Temp ),
Where( :Test_Temp == {"test temp1 ", "test temp2", "test temp3"} )
)
)
);
進階統計建模自動化和腳本編寫基礎資料分析與建模視窗回覆:在 JSL 中的圖形產生器中向變數新增條件最簡單的選擇是最有可能在創建圖形構建後刪除變量
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(528, 492),
Show Control Panel(0),
Variables(X(:weight), Y(:height), Group X(:sex)),
Elements(Points(X, Y, Legend(5)))
);
// gb << Get Variables; // depending on your graph calculating which index to remova can be a good idea
gb << Remove Variable(3);
wait(0);
您也可以使用表達式建立 Graph Builder() 訊息的 Variables() 部分
回覆:在 JSL 中的圖形產生器中向變數新增條件您可能需要用某些東西包裝您的 TestList[i3]。以下是一些選項
Names Default To Here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
mycol = "weight";
gb = dt << Graph Builder(
Size(528, 448),
Show Control Panel(0),
Variables(X(:age), X(:sex), Y(mycol)), // won't work
Elements(Position(1, 1), Points(X, Y, Legend(6))),
Elements(Position(2, 1), Points(X, Y, Legend(7)))
);
gb = dt << Graph Builder(
Size(528, 448),
Show Control Panel(0),
Variables(X(:age), X(:sex), Y(Eval(mycol))), // might work
Elements(Position(1, 1), Points(X, Y, Legend(6))),
Elements(Position(2, 1), Points(X, Y, Legend(7)))
);
Eval(EvalExpr(
gb = dt << Graph Builder(
Size(528, 448),
Show Control Panel(0),
Variables(X(:age), X(:sex), Y(Expr(NameExpr(AsColumn(mycol))))), // works
Elements(Position(1, 1), Points(X, Y, Legend(6))),
Elements(Position(2, 1), Points(X, Y, Legend(7)))
)
));
回覆:在 JSL 中的圖形產生器中向變數新增條件感謝 Jarmo 的幫助。您的程式碼運行得很好,但是當將相同的技術應用到我的原始程式碼中時,它卻不起作用。我的程式碼實際上確實創建了多個圖形構建器並附加它們。我嘗試在每個圖形生成器之後刪除變量,但似乎沒有任何區別。
我擁有的程式碼的簡化版本如下:
gb = {}; // initiate list
// loop through the test list
index = N Items( gb );//
gb[index + 1]= New Window( "Capability", hlb = H List Box() );
hlb << append(//
Graph Builder(
Size( 1800, 700),//
Variables(
X( :Temp, Position( 1 ) ),
X( :Location, Position( 1 ) ),
Y( TestList[i3] ), // this is
),
Elements( Histogram( X( 1 ), X( 2 ), X( 3 ), Y, Legend( 46 ), Means and Std Devs( 1 )),Smoother( X( 1 ), X( 2 ), X( 3 ), X( 4 ), Y, Legend( 49 ) ) ,Caption Box(
X( 1 ),
X( 2 ),
X( 3 ),
Y,
Legend( 51 ),
Summary Statistic( "Mean" ),
) ),
Local Data Filter(
.
.
.
.
.
.
.
),
SendToReport(
.
.
.
.
.
.
.
)
);
);
//end loop<BR />