스크립트로 여러 개의 상자 그림을 내보낼 때 데이터가 누락되었습니다.저는 JMP를 처음 사용하는데 여러 상자 그림을 내보내는 데 문제가 있습니다. 제 목표는 X축 변수가 다른 매개변수로 그룹화된 플롯을 만드는 것입니다. 하지만 내보낸 출력에는 X축 데이터가 일부 누락되어 있는데, 단일 특정 열을 사용하면 플롯이 올바른 경우에도 마찬가지입니다.
내 코드는 다음과 같습니다.
//桌面創建資料夾帶上當天日期
timestamp = Format Date(Today(), "ddmmyyyy");
desktop_path = Get Environment Variable("USErProfile") || "$DESKTOP";
folder_path = desktop_path || "/JMP_Analysis_" || timestamp ;
CreateDirectory(folder_path);
// Set the output directory to the newly created folder
outputDir = folder_path || "/";
dt = Open(
"$DESKTOP/file/file.xls",
Worksheets( "Sheet1" ),
Use for all sheets( 1 ),
Concatenate Worksheets( 0 ),
Create Concatenation Column( 0 ),
Worksheet Settings(
1,
Has Column Headers( 1 ),
Number of Rows in Headers( 1 ),
Headers Start on Row( 1 ),
Data Starts on Row( 2 ),
Data Starts on Column( 1 ),
Data Ends on Row( 0 ),
Data Ends on Column( 0 ),
Replicated Spanned Rows( 1 ),
Replicated Spanned Headers( 0 ),
Suppress Hidden Rows( 1 ),
Suppress Hidden Columns( 1 ),
Suppress Empty Columns( 1 ),
Treat as Hierarchy( 0 ),
Multiple Series Stack( 0 ),
Import Cell Colors( 0 ),
Limit Column Detect( 0 ),
Column Separator String( "-" )
)
);
//將導入EXCEL之JMP存檔
dt << Save(outputDir || "Joe_CrazyFileCR.jmp");
// Identify rows corresponding to "Upper Limit" and "Lower Limit"
upperRow = dt << Get Rows Where(:Site == "Upper Limit");
lowerRow = dt << Get Rows Where(:Site == "Lower Limit");
// Ensure valid row indices for limits
If(N Rows(upperRow) == 0 | N Rows(lowerRow) == 0,
Throw("Error: Missing 'Upper Limit' or 'Lower Limit' row in the data.")
);
// Get the first row indices for upper and lower limits
upperRowIndex = upperRow[1];
lowerRowIndex = lowerRow[1];
// Loop through each column
For( i = 4, i <= N Cols( dt ), i++,
// Get column reference and name
col = Column( dt, i );
colName = col << Get Name;
// Retrieve the limit values for the current column
upperLimit = Num(dt[upperRowIndex, i]);
lowerLimit = Num(dt[lowerRowIndex, i]);
// Create a box plot for the column
bp = dt << Graph Builder(
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables(
X( :Vendor1 ),
Y(col), // Box plot for the current column
Group X( :Vendor2 )
),
Elements( Box Plot( Y, Legend( 0 ) ) ),
// Add Reference Lines for Limits
SendToReport(
Dispatch(
{},
colName, // Use the column name to target the Y-axis scale,
ScaleBox,
{Add Ref Line(upperLimit, "Dashed", "Green", "Upper Limit"),
Add Ref Line(lowerLimit, "Dashed", "Red", "Lower Limit")}
)
)
);
// Save the plot as a JPEG file
bp << savepicture( outputDir || colName || ".jpeg", "JPEG" );
// Close the plot window without saving
);
Close All( data tables, No Save );그리고 이것은 데이터가 누락된 그림입니다:

UI로 직접 그릴 때는 문제가 없었습니다.

자동화 및 스크립팅맥 OSRe: 스크립트를 사용하여 여러 개의 상자 그림을 내보낼 때 데이터가 누락됩니다.귀하의 데이터(.jmp 파일)의 예를 제공해 주실 수 있나요?
Re: 스크립트를 사용하여 여러 개의 상자 그림을 내보낼 때 데이터가 누락됩니다.답변 감사합니다! 첨부파일에 jmp를 제공했습니다.
Re: 스크립트를 사용하여 여러 개의 상자 그림을 내보낼 때 데이터가 누락됩니다.내 초기 추측은 귀하의 스크립트에서 귀하의 그래프 빌더가 잘못 빌드되고 있다는 것입니다(귀하의 스크립트를 그래프를 수동으로 생성하여 얻은 스크립트와 비교해야 합니다). Elements 부분은 Box Plot에 대해 가장 잘못되었을 가능성이 큽니다.
bp = dt << Graph Builder(
Show Control Panel(0),
Show Legend(0),
Variables(
X(:Vendor1),
Y(Eval(col)), // Box plot for the current column
Group X(:Vendor2)
),
Elements(Box Plot(X, Y, Legend(1))),
// Add Reference Lines for Limits
SendToReport(
Dispatch({}, colName, // Use the column name to target the Y-axis scale,
ScaleBox,
{Add Ref Line(upperLimit, "Dashed", "Green", "Upper Limit"),
Add Ref Line(lowerLimit, "Dashed", "Red", "Lower Limit")}
)
)
);
또한 데이터를 수정하는 것을 고려할 것입니다. 사양 제한 행을 제거하는 방식으로 데이터를 수정하는 것이 좋습니다. 이는 실제로 데이터를 원하는 방식이 아니기 때문입니다. 변수에 저장하거나 열 속성으로 설정하거나 테이블 변수에 저장할 수 있습니다.
Re: 스크립트를 사용하여 여러 개의 상자 그림을 내보낼 때 데이터가 누락됩니다.Elements 사양에는 X 변수와 Y 변수가 선택되어 있어야 합니다. 코드에는 체크되어 있지 않습니다.

Elements 사양을 변경하세요
Elements( Box Plot( X, Y, Legend( 1 ) ) )
Re: 스크립트를 사용하여 여러 개의 상자 그림을 내보낼 때 데이터가 누락됩니다.네, 그게 문제입니다...ㅋㅋㅋ! 도와주셔서 감사하고 다음에 모든 세부 사항을 살펴보겠습니다...
한계 값이 참조 도면에 포함되지 않는다는 것을 확인했습니다. 저는 여전히 그 이유를 이해하려고 노력하고 있으며, 더 많은 결과를 검토할 것입니다. 현재 제가 아는 유일한 방법은 새로운 데이터 테이블로 한계 값을 분리하고 추가 루프 코드로 한계 데이터 테이블을 참조하는 것인데, 이는 저에게 복잡합니다.