こんにちは、
サブグループごとにプロットしている連続データがある変動チャートに取り組んでいます。「1Cから13C」、「16Cから28C」、「30Cから45C」の3つの温度帯のデータがあります。データで選択したフィルターカテゴリごとに参照線を描画したいのですが、3つの異なる参照線グループがあります。
添付ファイルとVariabilityスクリプトを参照してください。
私はスクリプトを書くのは比較的新しいです。JMPスクリプトコマンドを使用して、各参照行のコマンドを作成する方法を見てきました。データフィルターで選択した内容に基づいて、コマンドを動的にしたい。 (スクリプトの太字の下線付きセクション。
お知らせ下さい、
ありがとう
マット
New Window( "Sample set 1 - Variability Chart by Lot",
V List Box(
Variability Chart(
Y( :Test 1 ),
X( :Lot ),
Std Dev Chart( 0 ),
Local Data Filter( Add Filter( columns( :Temp Band 2 ) ) ),
SendToReport(
Dispatch(
{"Variability Chart for Test 1"},
"2",
ScaleBox,
{Min( 0.814090277777778 ), Max( 1.13166666666667 ), Inc( 0.05 ),
Minor Ticks( 1 ), Add Ref Line(
0, "Dotted", "Medium Light Gray", "", 1
), Add Ref Line( <U><STRONG>1.1</STRONG></U>, "Solid", "Black", "", 1 ),
Add Ref Line(<U> <STRONG>0.9</STRONG></U>, "Solid", "Black", "", 1 )}
)
)
),
Variability Chart(
Y( :Test 2 ),
X( :Lot ),
Std Dev Chart( 0 ),
Local Data Filter( Add Filter( columns( :Temp Band 2 ) ) )
),
Variability Chart(
Y( :Test3 ),
X( :Lot ),
Std Dev Chart( 0 ),
Local Data Filter( Add Filter( columns( :Temp Band 2 ) ) )
)
)
)
やあ@mcastner 、スクリプトを開始するためにかなり複雑なタスクを選択したと思います。以下はあなたが尋ねたことを行う方法です(私があなたを正しく解釈した場合)が、グラフビルダーを使用して箱ひげ図と線を同時に描画することでこれを簡単にできるかどうか疑問に思います。参照線の値はどのようにして思いつきますか?利用可能なデータ(中央値、分位数など)の要約である可能性はありますか、それとも数式列でそれを行うことができますか?
Names default to here(1);
dt = Open( "$Sample_data/big class.jmp" );
//Valeus for ref lines - hopefully populated by your script
reflines = Associative Array({
{"height",
Associative Array({
{ 12, 62 },
{ 13, 63 },
{ 14, 64 },
{ 15, 65 },
{ 16, 66 },
{ 17, 67 }
})
},
{"weight",
Associative Array({
{ 12, 112 },
{ 13, 113 },
{ 14, 114 },
{ 15, 115 },
{ 16, 116 },
{ 17, 117 }
})
}
});
//A window with a single data filter that will be applied to all graphs inside it
New Window("charts",
Data Filter Context Box(
H List Box(
ldf = dt << Data Filter( Local,
Add Filter(
columns( :age ),
Where( :age == 13 ),
Display( :age, N Items( 6 ) )
),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) )
),
vc1 = Variability Chart(
Y( :height ),
X( :sex )
);
vc2 = Variability Chart(
Y( :weight ),
X( :sex )
);
)
)
);
//Function that is called when data filter changes and when the window is first opened, this will redraw lines on charts
UpdateRefLines = function({},
//find out what ages were selected, there is probably a better way to do this too
filteredagelast = filteredage;
filteredage = median(dt:age[ldf << get filtered rows()]);
//detect if there was a change in the age (prevents flickering of the screen)
if(is missing(filteredagelast) | (filteredagelast != filteredage),
//remove any existing ref lines
(vc1 << XPath("//AxisBox[@charID=2]"))[1] << Revert Axis;
(vc2 << XPath("//AxisBox[@charID=2]"))[1] << Revert Axis;
//draw new lines
(vc1 << XPath("//ScaleBox[@ID=2]")) << Add Ref Line( reflines["height"][FilteredAge], "Solid", "Black", "", 1 );
(vc2 << XPath("//ScaleBox[@ID=2]")) << Add Ref Line( reflines["weight"][FilteredAge], "Solid", "Black", "", 1 );
)
);
//function called when data filter changes, here it only redraws reference lines
UpdatesOnRowStateChanges = function({x}, if(is matrix(x), UpdateRefLines ) );
//variable used to keep track of the last filter applied
filteredage = .;
//Assign function to data filter
rsh = vc1 << Make Row State Handler( dt, UpdatesOnRowStateChanges );
//draw initial reference lines
UpdateRefLines();
