안녕,
"Grid of Color-Coded Scatter Plots"라는 JSL 스크립트가 첨부된 작은 데이터 테이블을 생성하는 스크립트를 첨부합니다. 이 스크립트를 실행하면 각 산점도의 (2x2) 그리드를 표시하는 Graph Builder 출력이 생성됩니다. 모든 점에는 서로 다른 색상 및/또는 기호가 지정됩니다.
내가 가진 문제는 동일한 데이터 세트 내의 다른 열 세트 및/또는 차트에 표시되는 변수 수에 대한 차트의 변수를 교환할 수 있는 스크립트를 작성하려고 한다는 것입니다. X 및 Y 축 모두(예: 현재 예제에서는 (2x2) 그리드를 표시하지만 X 축에 세 번째 X 데이터 열을 추가하여 이를 (3x2) 그리드로 변경하고 싶을 수도 있습니다.)
저는 "<< 변수 추가" 및 "<< 변수 제거" 속성을 gb[GraphBuilderBox(1)](여기서 gb는 그래프 빌더 개체임)에 적용하여 차트의 한 변수 세트를 다른 세트로 바꾸는 방법을 알고 있습니다. 내가 무엇을 아직 해결 방법은 해당 Elements 문을 수정하는 방법입니다. 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 ) ),
)
)
);