JSL每次創建一條用於更改組的主幹線
你好,
我有這個腳本:
dt = Current Data Table();
listX = {"1","2"};
listY = {"test1", "test2", "test3"};
fybx = dt << FitYByX(
Y( Eval( listY ) ),
X( Eval( listX ) ),
Fit Where( :Group == "BL", Fit Spline( 0.1, Standardized, {Line Color( {213, 72, 87} )} ) ),
try(Fit Where( :Group == "Value0", Fit Spline( 0.1, Standardized, {Line Color( {57, 177, 67} )} ) )),
try(Fit Where( :Group == "Value1", Fit Spline( 0.1, Standardized, {Line Color( {64, 111, 223} )} ) )),
try(Fit Where( :Group == "Value2", Fit Spline( 0.1, Standardized, {Line Color( {207, 121, 38} )} ) )),);它基於一個列表創建x by y圖,我現在嘗試添加一條脊線,但是我有2個問題:
1.脊線應基於“組”列創建,並且可能具有不同的值(例如“ Value1”可能是“ Value4”或“ Value0”可能是“ Value34”),所以我需要找到一種創建方法如果可能的話,並附上清單
2.它會創建1條書脊線,而不是我想要的4條
我的桌子
| 團體 | 測試1 | 測試2 | 測試3 | 1個 | 1個 |
| BL | 1個 | 1個 | 1個 | 1個 | 1個 |
| BL | 2個 | 2個 | 2個 | 2個 | 65歲 |
| BL | 23 | 3 | 6 | 1個 | 1個 |
| POR | 2個 | 2個 | 2個 | 2個 | 2個 |
| 值1 | 1個 | 1個 | 1個 | 3 | 4 |
| POR | 5 | 7 | 2個 | 2個 | 2個 |
| 值1 | 7 | 5 | 1個 | 7 | 3 |
| 值2 | 2個 | 2個 | 2個 | 2個 | 2個 |
| 值0 | 8 | 1個 | 1個 | 1個 | 6 |
如果我用手做的話是這樣的:

然後按“組”進行選擇(我認為我需要以某種方式將其添加到腳本中)
然後單擊“彈性”->“擬合樣條曲線”->標記“標準化x”,然後單擊“確定”
最後我要添加的是行圖例

腳本編寫回复:JSL每次創建一條用於更改組的主幹線你好,
我認為您將需要對此進行表情處理。 您將從一個表達式開始,然後將內容插入其中……特別是,您將把擬合樣條曲線細節添加到由y表示的x表達式中。
表達式處理具有陡峭的學習曲線,但功能非常強大。
看看這能否使您走上想要的道路。 請注意,Insert Into()和Substitute()的組合將替代原始表達式中_XX_的各個組級別。
乾杯,
布雷迪
names default to here(1);
dt = current data table();
listX = {"1","2"};
listY = {"test1", "test2", "test3"};
bivExpr = expr(
Bivariate(
Y( evallist(listY) ),
X( evallist(listx) ),
)
);
groupList = (associative array(dt:group << get values)) << get keys;
for (i = 1, i<=nitems(groupList), i++,
insertinto(bivExpr, substitute(expr(Fit Where( :Group == _XX_, Fit Spline( 0.1, {Line Color( {212, 73, 88} )} ))), expr(_XX_), groupList[i] ))
);
show(nameexpr(bivExpr));
bivExpr;回复:JSL 為每次更改組創建一條脊線非常感謝!這有效!
如果有人想要脊柱線的不同顏色
ColorList = {};
AList = {207, 121, 38};
BList = {64, 111, 223};
CList = {57, 177, 67};
DList = {213, 72, 87};
InsertInto(ColorList, EvalList(List(AList)));
InsertInto(ColorList, EvalList(List(BList)));
InsertInto(ColorList, EvalList(List(CList)));
InsertInto(ColorList, EvalList(List(DList)));
for (i = 1, i<=nitems(groupList), i++,
insertinto(bivExpr, substitute(expr(Fit Where( :Group == _XX_, Fit Spline( 0.1, {Line Color( _YY_ )} ))), expr(_XX_), groupList[i],expr(_YY_), ColorList[i] ))
);