こんにちは、
「Grid of Color-Coded Scatter Plots」という JSL スクリプトが添付された小さなデータ テーブルを生成するスクリプトを添付します。これを実行すると、それぞれに (2x2) の散布図のグリッドを示すグラフ ビルダーの出力が生成されます。すべての点には異なる色や記号が与えられます。
私が抱えている問題は、そのようなグラフ内の変数を同じデータセット内の別の列セット、および/またはどちらかでグラフ化されている変数の数と交換できるようにするスクリプトを書こうとしていることです。 X 軸と Y 軸の両方 (たとえば、この例では現在 (2x2) グリッドが表示されていますが、X 軸に 3 番目の X データ列を追加して、これを (3x2) グリッドに変更したい場合があります)。
「<< 変数の追加」プロパティと「<< 変数の削除」プロパティを gb[GraphBuilderBox(1)] に適用して、チャート内の変数のセットを別のセットに交換する方法を知っています。gb はグラフ ビルダー オブジェクトです。 私がしていない対応する要素ステートメントを変更する方法を解決できました。 GraphBuilderBox 表示ボックスに適用される例がスクリプト索引にありますが、そこにある「<< 要素の追加」の例は適合線の追加に関連しており、これを要素の追加を含む私の問題に関連付ける方法がわかりません「位置」パラメータと「ポイント」パラメータを使用します。
誰かが私に適応できそうな構文の例をいくつか教えてくれませんか?
どうもありがとう。
New Table( "JMP Script Demo",
Add Rows( 4 ),
Compress File When Saved( 1 ),
New Script("Grid of Color-Coded Scatter Plots",
Graph Builder(
Size( 713, 469 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Grid Color( "White" ),
Graph Spacing( 10 ),
Spacing Borders( 1 ),
Variables(
X( :X1 ),
X( :X2 ),
Y( :Y3A ),
Y( :Y3B, Position( 1 ) ),
Y( :Y3C, Position( 1 ) ),
Y( :Y3D, Position( 1 ) ),
Y( :Y2A ),
Y( :Y2B, Position( 2 ) ),
Y( :Y2C, Position( 2 ) ),
Y( :Y2D, Position( 2 ) )
),
Elements( Position( 1, 1 ), Points( X, Y( 1 ), Y( 2 ), Y( 3 ), Y( 4 ), Legend( 73 ) ) ),
Elements( Position( 1, 2 ), Points( X, Y( 1 ), Y( 2 ), Y( 3 ), Y( 4 ), Legend( 78 ) ) ),
Elements( Position( 2, 1 ), Points( X, Y( 1 ), Y( 2 ), Y( 3 ), Y( 4 ), Legend( 77 ) ) ),
Elements( Position( 2, 2 ), Points( X, Y( 1 ), Y( 2 ), Y( 3 ), Y( 4 ), Legend( 79 ) ) ),
SendToReport(
Dispatch( {}, "X1", ScaleBox, {Label Row( Show Major Grid( 1 ) )} ),
Dispatch( {}, "X2", ScaleBox, {Label Row( Show Major Grid( 1 ) )} ),
Dispatch( {}, "Y3A", ScaleBox, {Label Row( Show Major Grid( 1 ) )} ),
Dispatch( {}, "Y2A", ScaleBox, {Label Row( Show Major Grid( 1 ) )} ),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
73,
Properties( 0, {Line Color( 3 ), Marker( "Filled Diamond" )} ),
Properties( 1, {Line Color( 36 ), Marker( "FilledCircle" )} ),
Properties( 2, {Line Color( 5 ), Marker( "Square" )} ),
Properties( 3, {Line Color( 8 ), Marker( "FilledCircle" )} )
), Legend Model(
78,
Properties( 0, {Line Color( 3 ), Marker( "Filled Diamond" )} ),
Properties( 1, {Line Color( 36 ), Marker( "FilledCircle" )} ),
Properties( 2, {Line Color( 5 ), Marker( "Square" )} ),
Properties( 3, {Line Color( 8 ), Marker( "FilledCircle" )} )
), Legend Model(
77,
Base( 0, 0, 0 ),
Base( 1, 0, 1 ),
Base( 2, 0, 2 ),
Base( 3, 0, 3 ),
Properties( 0, {Line Color( 3 ), Marker( "Filled Diamond" )} ),
Properties( 1, {Line Color( 36 ), Marker( "FilledCircle" )} ),
Properties( 2, {Line Color( 5 ), Marker( "Square" )} ),
Properties( 3, {Line Color( 8 ), Marker( "FilledCircle" )} )
), Legend Model(
79,
Properties( 0, {Line Color( 3 ), Marker( "Filled Diamond" )} ),
Properties( 1, {Line Color( 36 ), Marker( "FilledCircle" )} ),
Properties( 2, {Line Color( 5 ), Marker( "Square" )} ),
Properties( 3, {Line Color( 8 ), Marker( "FilledCircle" )} )
)}
),
Dispatch( {}, "graph title", TextEditBox, {Set Text( "Grid of Color-Coded Scatter Plots" )} ),
Dispatch( {}, "Y title", TextEditBox, {Set Text( "Y3A, Y3B, Y3C & Y3D" )} ),
Dispatch( {}, "Y 1 title", TextEditBox, {Set Text( "Y2A, Y2B, Y2C & Y2D" )} )
)
)
),
New Column( "Sample",
Character( 24 ),
"Nominal",
Set Values( {"Sample A", "Sample B", "Sample C", "Sample D"} )
),
New Column( "X1",
Numeric,
"Continuous",
Format( "Fixed Dec", 10, 2 ),
Set Values( [6.14, 5.14, 6.64, 6.72] )
),
New Column( "X2",
Numeric,
"Continuous",
Format( "Fixed Dec", 10, 2 ),
Set Values( [4.62, 4.52, 4.66, 4.84] )
),
New Column( "X3",
Numeric,
"Continuous",
Format( "Fixed Dec", 10, 2 ),
Set Values( [2.17, 2.52, 3.48, 2.25] )
),
New Column( "Y1A", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [6.14, ., ., .] ) ),
New Column( "Y1B", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [., 5.14, ., .] ) ),
New Column( "Y1C", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [., ., 6.64, .] ) ),
New Column( "Y1D", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [., ., ., 6.72] ) ),
New Column( "Y2A", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [4.62, ., ., .] ) ),
New Column( "Y2B", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [., 4.52, ., .] ) ),
New Column( "Y2C", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [., ., 4.66, .] ) ),
New Column( "Y2D", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [., ., ., 4.84] ) ),
New Column( "Y3A", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [2.17, ., ., .] ) ),
New Column( "Y3B", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [., 2.52, ., .] ) ),
New Column( "Y3C", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [., ., 3.48, .] ) ),
New Column( "Y3D", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [., ., ., 2.25] ) ),
Set Row States( [8, 8, 8, 8] ),
Set Label Columns( :Sample )
)
これが他にどのような影響を与えるのかはわかりませんが、要素を直接変更せずに、新しい位置に変数を追加するだけで、列と行を追加および削除できます。
gb = Graph Builder(
Size( 713, 469 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Grid Color( "White" ),
Graph Spacing( 10 ),
Spacing Borders( 1 ),
Variables(
X( :X1 ),
X( :X2 ),
Y( :Y3A, Position( 1 ) ),
Y( :Y3B, Position( 2 ) ),
)
);
gbb = Report( gb )[Graph Builder Box( 1 )];
gbb << Add Variable( { :Y3C, Role( "Y" ), Position( 3 ) } );
gbb << Remove Variable( {:Y3A, Role( "Y" ), Position( 1 ) } )
あるいは、グラフを正しい要素数を持つ新しいグラフに置き換えることもできます。
New Window( "Graph",
lb = H list box(
gb = Graph Builder(
Size( 713, 469 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Grid Color( "White" ),
Graph Spacing( 10 ),
Spacing Borders( 1 ),
Variables(
X( :X1 ),
X( :X2 ),
Y( :Y3A, Position( 1 ) ),
Y( :Y3B, Position( 2 ) ),
)
)
);
);
Try( gb << Delete );
lb << Append(
gb = Graph Builder(
Size( 713, 469 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Grid Color( "White" ),
Graph Spacing( 10 ),
Spacing Borders( 1 ),
Variables(
X( :X1 ),
X( :X2 ),
Y( :Y3A, Position( 1 ) ),
Y( :Y3C, Position( 2 ) ),
)
)
);