列の値に基づいて分布内のビンを強調表示し、ビンの移行を強調表示します。ユニットの母集団を含む分布のセットがあります。select whereとcontainsitem呼び出しを使用して、特定の DUT 参照 ID 番号に一致するデータセット内のリスト項目を選択しました。これにより、対象のユニットの測定値がどのビンに含まれているかがわかります。選択の各インスタンスのテストの日付を使用して、測定値を含むビンを強調表示したいと思います。たとえば、同じユニットが 2024 年 6 月 20 日にテストされ、その後 2024 年 6 月 25 日に再度テストされ、さらに 2024 年 6 月 28 日にもう一度テストされた場合、6/20 のビンの結果は 1 つの色で強調表示され、6/25、6/28 のビンの結果は他の 2 つの色で強調表示されます。その他の目標は、レポート内の分布全体でこれらの色の一貫性を保ち (テストの日付ごとに 1 つの色)、選択されていないすべてのユニットはデフォルトの色のままにすることです。また、それぞれのビンのプロットの上から下に向かって強調表示したいと思います。
皆様のご支援に心より感謝申し上げます。
//dtmain << select where(:SN=="12346777" | :SN=="12346982");
dtmain << select where(ContainsItem(:SN, {"12346777", "12346982"}));
Distribution(
Stack( 1 ),
Continuous Distribution(
Column( :Average ),
Horizontal Layout( 1 ),
Vertical( 0 ),
Set Bin Width( 2 ),
Process Capability( 0 )
),
Continuous Distribution(
Column( :Min ),
Horizontal Layout( 1 ),
Vertical( 0 ),
Set Bin Width( 2 ),
Process Capability( 0 )
),
Continuous Distribution(
Column( :Max ),
Horizontal Layout( 1 ),
Vertical( 0 ),
Set Bin Width( 2 ),
Process Capability( 0 )
),
By(
:TID, :BLOCKNAME, :MEAS_TYPE
)
);

私が達成したいことのモックアップ:

基本的なデータ分析とモデリング信頼性分析Re: 列の値に基づいて分布内のビンを強調表示し、ビンの移行を強調表示するサンプル フォルダーから適切なファイルを選択し、問題を説明するモックアップを作成していただけますか?
メリット:
- 時間を節約する(#1):
ユーザーがモックアップデータセットを作成する必要はありません - 時間を節約する(#2):
問題を理解するのに役立つ - すべての返信は共通のモックアップに基づいて行われます
-> 比較しやすい

たとえば、元のデータの代わりに温度データ、状態の選択、四半期ごとの色、DUT の選択、測定日ごとの色など、これが興味のあることでしょうか?
dt = Open( "$SAMPLE_DATA/Functional Data/Weekly Weather Data.jmp" );
dt << New Column( "selected Quarter",
"Ordinal",
Formula( If( Selected(), Quarter( :DATE ) ) ),
Set Property(
"Value Colors",
{1 = -13912408, 2 = -4042310, 3 = -4354269, 4 = -13400361}
)
);
dt << Graph Builder(
Transform Column( "temperature", Formula( Round( :TAVG / 2 ) * 2 ) ),
Size( 568, 328 ),
Show Control Panel( 0 ),
Variables( X( :STATION ), X( :temperature ), Overlay( :selected Quarter ) ),
Elements( Position( 1, 1 ), Bar( X, Overlay( 0 ), Legend( 9 ), Bar Style( "Stacked" ) ) ),
Elements( Position( 2, 1 ), Bar( X, Legend( 1 ), Bar Style( "Stacked" ) ) ),
SendToReport(
Dispatch( {}, "400", ScaleBox,
{Legend Model( 1, Properties( 0, {Fill Color( 32 )}, Item ID( "Missing", 1 ) ) )}
),
Dispatch( {}, "Graph Builder", FrameBox( 2 ), {Fill Selection Mode( "Unselected Faded" )} )
)
);
Re: 列の値に基づいて分布内のビンを強調表示し、ビンの移行を強調表示する参照線を使ってこれを行うこともできます
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dist = dt << Distribution(
Stack(1),
Continuous Distribution(
Column(:height),
Horizontal Layout(1),
Vertical(0),
Set Bin Width(2),
Process Capability(0)
)
);
ab = Report(dist)[AxisBox(1)];
ab << Add Ref Line({60, 62}, "Solid", "Red", "", 1, 0.25);
ab << Add Ref Line({62, 64}, "Solid", "Green", "", 1, 0.25);
ab << Add Ref Line({64, 66}, "Solid", "Blue", "", 1, 0.25);

またはグラフィックスクリプトを使用する
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dist = dt << Distribution(
Stack(1),
Continuous Distribution(
Column(:height),
Horizontal Layout(1),
Vertical(0),
Set Bin Width(2),
Process Capability(0)
)
);
fb = Report(dist)[FrameBox(2)];
fb << Add Graphics Script(
1,
Transparency(0.2);
Fill Color("Red");
Rect(68, Y Range() + 10, 70, Y Origin(), 1);
Transparency(0.2);
Fill Color("Light Green");
Rect(70, Y Range() + 10, 72, Y Origin(), 1);
);

すべての分布で同じ色付けを取得するには、日付の値の色のプロパティを設定し、色を設定するときにそれを利用するか、色のリストを作成し、それらを順番に使用します。
Re: 列の値に基づいて分布内のビンを強調表示し、ビンの移行を強調表示するこれを行う方法についての私の見解は次のとおりです。選択された行とそれに関連付けられたビンを検索し、必要に応じて参照線を追加します。

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// For illustration, randomly select some rows
For( i = 1, i <= 3, i++,
dt << select rows( Random Integer( 1, N Rows( dt ) ) )
);
dist = dt << Distribution(
Stack( 1 ),
Continuous Distribution(
Column( :height ),
Quantiles( 0 ),
Summary Statistics( 0 ),
Horizontal Layout( 1 ),
Vertical( 0 ),
Set Bin Width( 2 ),
Process Capability( 0 )
)
);
distRPT = Report( dist )[AxisBox( 1 )];
// Find the Midpoints of the bins the selected rows are in
dist << Save( "Level Midpoints" );
theBins = (Associative Array( Column( dt, N Cols( dt ) )[dt << get selected rows] )) << get keys;
dt << delete columns( N Cols( dt ) );
// Get the Increment of the X axis
theIncr = distRPT[AxisBox( 1 )] << get inc;
// Add the reference lines for each selected bin
For Each( {bin, index}, theBins,
binList = {};
Insert Into( binList, bin - theIncr / 2 );
Insert Into( binList, bin + theIncr / 2 );
Eval( Eval Expr( distRPT << Add Ref Line( Expr( binList ), "Solid", Expr( Index + 2 ), "", 1, 0.25 ) ) );
);
これを拡張して、ユーザーがさまざまな行を選択および選択解除するとグラフがインタラクティブに変化するようにするには、RowState ハンドラーと、最初に既存の参照線を削除してから新しい参照線を追加するロジックを追加する必要があります。
Re: 列の値に基づいて分布内のビンを強調表示し、ビンの移行を強調表示する答えるべき質問:
色をどのように割り当て、範囲をどのようにマークするか。
たとえば、選択した ID の 6/20 のデータが 48、90 (77、56、...) の場合。
またはその逆: 特定の日付に選択されたすべてのデバイス ID のデータが同じビンにあることを確信できますか?
Re: 列の値に基づいて分布内のビンを強調表示し、ビンの移行を強調表示する了解しました。ありがとうございます。ご提案いただいたように、利用可能なデータを使用して質問を調整します。
Re: 列の値に基づいて分布内のビンを強調表示し、ビンの移行を強調表示するご支援ありがとうございます。
あなたと@jthi が提案したように、私は add Ref を使用できました。色付けにこのアプローチを使用し、単一の分布で機能することを確認しました。By 条件を追加すると、プロット アドレス指定機能が失われ、エラーが発生します。
@hogiの提案に従って、この質問では利用可能なデータに切り替えました。質問を容易にするために、ジムのスクリプトの修正版で Big Class を拡張しました。私が実行した手順と結果は次のとおりです。
1. ビッグクラスのインポート
2. 列「State」がテーブルにない場合は条件付きでデータを追加する
a. 人々を「CA」、「WA」、または「OR」のいずれかに配置するために、順序付けられたデータを含む「State」という列を追加します。
b. 16歳、女性、57、134歳、WAに住む2人目の「PATTY」を追加します。
3. 名前をいくつか選択します。私はLESLIEとPATTYを選択しました。
4. スクリプトを実行して、興味のあるビンを見つけて強調表示します。
わかりました Case - remove By (:State) from the script below and change the preceding comma to a semicolon to run successfully. The code finds both instances of Patty and uses different colors for each of them. If they had the same height, for this example the reference lines would overlap only showing one of the two colors.
@hogi は、どの色を表示するかの調整について良い点を指摘しました。要素のアドレス指定を理解したら、同じビンに複数の興味深いデータ ポイントが発生する場合の条件を追加する予定です。

NGケース - :State に基づく By 条件で分布を実行すると、プロット オブジェクトのアドレス指定でエラーが発生します。アドレス指定の順列をいくつか試しましたが、成功しませんでした。AxisBox にアクセスするための重要な情報が不足しています。
どちらも動作しませんでした:
distRPT = Report(dist)["高さ",AxisBox(1)];
distRPT = Report( dist )["州=WA","高さ",AxisBox( 1 )];
distRPT = Report( dist["State=WA"] )["height",AxisBox( 1 )];
サンプル エラー コード: 'Report(dist)[ /*###*/AxisBox(1)]'、Report(dist)[/*###*/AxisBox( 1 )] のアクセスまたは評価で、行 41 にオブジェクトを添え字として付けることができません
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
col_name_list = dt << get column names(string);
newColName = "State";
// New column: State
if (!contains(col_name_list, newColName),
Local( {dt, tempStrings},
dt = Data Table( "Big Class" );
dt << New Column( "State", Character, "Nominal" ) << Begin Data Update;
tempStrings = {"CA", "WA", "OR"};
For Each Row( dt, :State = tempStrings[Sequence( 1, 3, 1, 1 )] );
dt << End Data Update;
);
//Make it a double Patty :), another person with the same name.
dt << Add Rows( 1, At End );
//Cheat and use a constant of 41 for the last row index
dt[[41],{name,age,sex,height,weight,State}] = {{"PATTY", 16, "F", 57, 134, "WA"}};
);
// For illustration, select some names
dt << select where( ContainsItem(:name, {"LESLIE","PATTY"}));
dist = dt << Distribution(
Stack( 1 ),
Continuous Distribution(
Column( :height ),
Quantiles( 0 ),
Summary Statistics( 0 ),
Horizontal Layout( 1 ),
Vertical( 0 ),
Set Bin Width( 2 ),
Process Capability( 0 )
),
By (:State)
);
distRPT = Report( dist )[AxisBox( 1 )];
// Find the Midpoints of the bins the selected rows are in
dist << Save( "Level Midpoints" );
theBins = (Associative Array( Column( dt, N Cols( dt ) )[dt << get selected rows] )) << get keys;
dt << delete columns( N Cols( dt ) );
// Get the Increment of the X axis
theIncr = distRPT[AxisBox( 1 )] << get inc;
// Add the reference lines for each selected bin
For Each( {bin, index}, theBins,
binList = {};
Insert Into( binList, bin - theIncr / 2 );
Insert Into( binList, bin + theIncr / 2 );
Eval( Eval Expr( distRPT << Add Ref Line( Expr( binList ), "Solid", Expr( Index + 2 ), "", 1, 0.25 ) ) );
);
皆様のご意見やご指導をお待ちしております。
ありがとう!
ブライアン
Re: 列の値に基づいて分布内のビンを強調表示し、ビンの移行を強調表示するニース : )
「適切な軸ボックスを見つける」に関して、ウィッシュリストに次の希望があります:
JSL経由でレポートから結果を取得しやすくする
ステータスは「キュー内」です。レポートから結果を取得しやすくなるだけでなく、適切な軸ボックスを見つける方法も容易になることを期待しています...
Re: 列の値に基づいて分布内のビンを強調表示し、ビンの移行を強調表示する私の最初の推測は、Byを使用しているときに、リストに対してReport()関数を使用しようとしているということです(Show(dist);を使用してdistに含まれるものを確認してください)。
Re: 列の値に基づいて分布内のビンを強調表示し、ビンの移行を強調表示するBY グループが必要な場合は、少し複雑になります。
サブプロットごとに異なるビン幅を設定できます。このため、 for ループが必要になります。
- 個々のビンの幅を取得します。
- 特定のサブプロットの選択された行を取得する
- 特定のサブプロットに参照線を追加します。
うーん、影付きの領域のアイデアを再考する必要があるかもしれません。色の問題もあります。
現時点では、選択したビンごとに異なる色を適用しています。影付きの領域は見栄えが良いですが、幅はかなり恣意的です。選択した ID ごとに 1 行追加するだけでよいのではないでしょうか。いくつの「ID」を選択しますか?
テープのような臭いがしたら、車輪の再発明をしているのだろうかと自問する時です。
一般的に、グラフ ビルダーはレポート レイヤーと通信する必要なく、このような処理を自動的に実行できます...
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
col_name_list = dt << get column names( string );
newColName = "State";
// New column: State
If( !Contains( col_name_list, newColName ),
Local( {dt, tempStrings},
dt = Data Table( "Big Class" );
dt << New Column( "State", Character, "Nominal" ) << Begin Data Update;
tempStrings = {"CA", "WA", "OR"};
For Each Row( dt, :State = tempStrings[Sequence( 1, 3, 1, 1 )] );
dt << End Data Update;
);
//Make it a double Patty :), another person with the same name.
dt << Add Rows( 1, At End );
//Cheat and use a constant of 41 for the last row index
dt[[41], {name, age, sex, height, weight, State}] = {{"PATTY", 16, "F", 57, 134, "WA"}};
);
// For illustration, select some names
dt << select where( Contains Item( :name, {"LESLIE", "PATTY"} ) );
dist = dt << Distribution(
Stack( 1 ),
Continuous Distribution(
Column( :height ),
Quantiles( 0 ),
Summary Statistics( 0 ),
Horizontal Layout( 1 ),
Normal Quantile Plot( 0 ), // disable, if the user enabled it in the preferences :)
Vertical( 0 ),
Set Bin Width( 2 ),
Process Capability( 0 )
),
By( :State )
);
// get all reports
// if there is a BY group, get the info - if there is none, put it into a list
If( Is List( dist ),
dists=dist;
myBys = Transform each ({myexpr} , dist << Get Where Expr, Arg(myExpr , 2 ))
, //no By
dists = Eval List( {dist} );
myBys= {};
);
//get the reports
distRPTs = Transform Each( {dist}, dists, Report( dist ) );
// Find the Midpoints of the bins the selected rows are in
dist << Save( "Level Midpoints" );
//loop though the By groups and add the reflines
For Each( {report, idx}, distRPTs,
//report = distRPTs[2]; idx=2;
selected rows = dt << get selected rows;
// there is a BY group -> restrict the selection
if(N Items(myBys),
Eval( Eval Expr( selected rows = dt << get rows where( Contains( Expr( selected rows ), Row() ) & :State == Expr( myBys[idx] ) ) ) );
);
theBins = (Associative Array( Column( dt, N Cols( dt ) )[selected rows] )) << get keys;
// Get the Increment of the X axis
theIncr = report[AxisBox( 1 )] << get inc;
// Add the reference lines for each selected bin
For Each( {bin, index}, theBins,
//bin = 57; index=1
binList = {};
Insert Into( binList, bin - theIncr / 2 );
Insert Into( binList, bin + theIncr / 2 );
Eval( Eval Expr(report[AxisBox( 1 )] << Add Ref Line( Expr( binList ), "Solid", Expr( Index + 2 ), "", 1, 0.25 ) ) );
);
);
dt << delete columns( N Cols( dt ) );Re: 列の値に基づいて分布内のビンを強調表示し、ビンの移行を強調表示するグラフビルダー経由:
New Column( "selected",
Character,
Formula( If( Col Maximum( Selected( Row State() ), :name ), :name, "-" ) )
)
New Window( "try",
H List Box(
Graph Builder( Size( 519, 452 ), Show Control Panel( 0 ), Show Legend( 0 ), Variables( X( :name ) ), Elements( Bar( X ) ) );
gb = Graph Builder(
Size( 487, 500 ),
Show Control Panel( 0 ),
Variables( X( :height ), Wrap( :State ), Color( :selected ) ),
Elements(
Heatmap( X, Legend( 8 ) ),
Histogram( X, Legend( 6 ), Response Scale( "Fill" ) ),
Points( X, Legend( 9 ), Jitter( "None" ) )
),
SendToReport(
Dispatch( {}, "400", ScaleBox,
{Legend Model( 8, Properties( 0, {Transparency( 0 )}, Item ID( "-", 1 ) ) ), Legend Model(
9,
Properties( 0, {Transparency( 0 )}, Item ID( "-", 1 ) )
)}
)
)
);
)
);
(gb << xpath( "//FrameBox" )) << {Marker Drawing Mode( "Outlined" ), Marker Size( 10 ), Transparency( 0.5 ),
Fill Selection Mode( "Unselected Faded" )};
Re: 列の値に基づいて分布内のビンを強調表示し、ビンの移行を強調表示するご返信ありがとうございます。個々のプロットに対応するようにコードを調整することができました。私の分析では、条件セットごとに 3 つのサブプロットがあります。サブプロット インデックスをハードコーディングすることにしました。
If( Is List( rptDist ),
dists=rptDist;
myBys1 = Transform each ({myexpr} , rptDist << Get Where Expr, Arg(myExpr , 1 ));
myBys2 = Transform each ({myexpr} , rptDist << Get Where Expr, Arg(myExpr , 2 ));
myBys3 = Transform each ({myexpr} , rptDist << Get Where Expr, Arg(myExpr , 3 ));
, //else condition - no By conditions in Distribution call
dists = Eval List( {rptDist} );
myBys= {};
);新たな課題に取り組みます。連想配列呼び出しを使用すると情報が失われます。ここでのプロット目標は達成されたので、次の課題については別の投稿を作成します。
みなさんありがとう!
Re: 列の値に基づいて分布内のビンを強調表示し、ビンの移行を強調表示するこんにちは、ジャーモさん
I've added the nested for loops which achieved the desired result. Without the second loop the added reference would only appear in the first of the three plots. Please note that I assigned numOfPlots a constant value of 3. I was looking for a way to interrogate the report(AxisBox... for dimensions, but I did not find the right object to return the correct count.
分布を生成し、参照線で注釈を付けるには、全部で 3 つのネストされた for ループが必要です。
...
For Each( {report, idx}, distRPTs, //grab each report in the
...
For Each( {bin, index}, theBins, //process bin for each report
...
For( iPlot = 1, iPlot <= numOfPlots, iPlot +=1, << add refer. in each of the subplots.
...
...<BR />For Each( {bin, index}, theBins,
binList = {};
//TBD change bin width to avoid offset when bin width is an odd number
Insert Into( binList, bin - theIncr / 2 );
Insert Into( binList, bin + theIncr / 2 );
For( iPlot = 1, iPlot <= numOfPlots, iPlot +=1,
Eval( Eval Expr(report[AxisBox( iPlot )] << Add Ref Line( Expr( binList ), "Solid", Expr( Index + 2 ), "", 1, 0.25 ) ) );
);
);