Current Journal
Current Journal using Chart
Example 1
Summary: Creates and exports a bar chart with error bars to visualize mean height by sex, utilizing JMP's Chart platform.
Code:
dt = Open("data_table.jmp");
rpt = dt << Chart( X( :sex ), Y( Mean( :height ) ), Add Error Bars to Mean( Standard Error( 2 ) ), Bar Chart( 1 ) );
rpt << journal;
jnl = Current Journal();
isFileExists = File Exists( "$TEMP/errorBar.pdf" );
jnl << save pdf( "$TEMP/errorBar.pdf" );
Code Explanation:
- Open data table.
- Create chart with sex on X-axis.
- Calculate mean height for each sex.
- Add error bars for mean height.
- Use bar chart style.
- Convert chart to journal.
- Get current journal reference.
- Check if PDF file exists.
- Save journal as PDF.
- Save PDF to temporary directory.
Example 2
Summary: Creates and saves a bar chart from a data table, displaying mean height by sex with error bars for standard error.
Code:
dt = Open("data_table.jmp");
rpt = dt << Chart( X( :sex ), Y( Mean( :height ) ), Add Error Bars to Mean( Standard Error( 2 ) ), Bar Chart( 1 ) );
rpt << journal;
jnl = Current Journal();
jnl << Save Journal( "$TEMP/myTest.jrn" );
Code Explanation:
- Open data table.
- Create chart object.
- Set X-axis to sex.
- Set Y-axis to mean height.
- Add error bars for standard error.
- Display as bar chart.
- Convert report to journal.
- Get current journal.
- Save journal to file.
Current Journal using Window
Summary: Creates and manipulates windows, data tables, charts, and journals in JMP, including setting window titles, renaming data tables, generating bar charts with error bars, and saving reports as PDFs.
Code:
myWin = Window( "estimatingPi" );
myWin << set window title( "Bla Bla Bla" );
myWin << get window title();
myWin << closewindow();
lst = Get Log( -6 );
dt = Open("data_table.jmp");
dt << setname( "Ding" );
myWin = Window( "Ding" );
myWin << closewindow();
dt = Open("data_table.jmp");
rpt = dt << Chart( X( :sex ), Y( Mean( :height ) ), Add Error Bars to Mean( Standard Error( 2 ) ), Bar Chart( 1 ) );
rpt << journal;
jnl = Current Journal();
isFileExists = File Exists( "$TEMP/errorBar.pdf" );
jnl << save pdf( "$TEMP/errorBar.pdf" );
Code Explanation:
- Open estimatingPi.jsl script.
- Create window named "estimatingPi".
- Set window title to "Bla Bla Bla".
- Retrieve and print window title.
- Close the window.
- Get log entries from -6.
- Open data table.
- Rename data table to "Ding".
- Create window named "Ding".
- Close the window.
- Reopen data table.
- Create bar chart with error bars.
- Convert report to journal.
- Save journal as PDF.