Dati mancanti quando si esportano più box plot con uno script.Sono nuovo di JMP e ho riscontrato problemi nell'esportazione di più box plot. Il mio obiettivo è creare grafici con variabili dell'asse X raggruppate in base a un altro parametro. Tuttavia, l'output esportato non contiene alcuni dati dell'asse X, anche se i grafici sono corretti quando utilizzo una singola colonna specifica.
Ecco il mio codice:
//桌面創建資料夾帶上當天日期
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 );E questa è l'immagine con i dati mancanti:

E nessun problema quando ho disegnato direttamente tramite l'interfaccia utente:

Automazione e scriptingsistema operativo macOSR: Dati mancanti quando si esportano più box plot con uno script.Puoi fornire un esempio dei tuoi dati (file .jmp)?
R: Dati mancanti quando si esportano più box plot con uno script.Grazie per la risposta! Fornisco jmp nell'allegato.
R: Dati mancanti quando si esportano più box plot con uno script.La mia ipotesi iniziale è che il tuo generatore di grafici sia stato creato in modo errato nel tuo script (assicurati di confrontare il tuo script con quello che ottieni creando manualmente il grafico). La parte Elementi è molto probabilmente errata per 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")}
)
)
);
Inoltre, prenderei in considerazione la modifica dei tuoi dati in modo tale da rimuovere le righe di limite di specifica, poiché non è proprio così che vorresti avere i tuoi dati. Puoi memorizzarli in una variabile, impostarli come proprietà di colonna o forse memorizzarli in variabili di tabella.
R: Dati mancanti quando si esportano più box plot con uno script.La specifica di Elements deve avere la variabile X selezionata così come la variabile Y. Il tuo codice non la controlla

Cambia la specifica degli Elementi in
Elements( Box Plot( X, Y, Legend( 1 ) ) )
R: Dati mancanti quando si esportano più box plot con uno script.Sì, è proprio questo il problema...lol! Grazie per l'aiuto e la prossima volta esaminerò tutti i dettagli...
Ho confermato che i valori limite non sono inclusi nei disegni di riferimento. Sto ancora cercando di capire perché, ed esaminerò altri risultati. Attualmente, l'unico modo che conosco è separare i valori limite con una nuova tabella dati e fare riferimento alla tabella dati limite con codice loop aggiuntivo, il che è complicato per me.