Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
simon_2
Level II

How to save journal as PPT (2 graphs per slide) using JSL

Hello users,

I am trying to save a journal as powerpoint. I would like to save 2 graphs per powerpoint slide instead of just one.

Right now I get 1 graph per slide. I want 2 graphs per slide.

 

simon_2_0-1595967729809.png

 

How do I go about doing that using JSL?

 

My JSL script is:

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Fitness.jmp" );
obj = Logistic( Y( :Name ), X( :RstPulse ), By( :Age) );
obj << journal;
Current Journal() << Save Presentation("fitness_logistic.pptx");

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: How to save journal as PPT (2 graphs per slide) using JSL

Here is a modification of your script that produces the graphs at two graphs per page.  It does this by creating a picture of the 2 graphs, and then adding that to the journal, not the original graphs.

ppt.PNG

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Fitness.jmp" );
obj = Logistic( invisible, Y( :Name ), X( :RstPulse ), By( :Age ) );
jour = New Window( "The Journal", <<journal, vlb = V List Box() );

// Loop through the outputs and put them into the journal
// as an Outline Box....to set the title
// and a picture of 2 of the logistic plots
// If the number of plots produced is an odd number, then
// don't allow the script to error out by using Try() on the second
// graphs in each loop
For( i = 1, i <= N Items( obj ), i = i + 2,
	ob = Outline Box( "OB", hlb1 = H List Box() );
	ob << set title( Report( obj[i] )[Outline Box( 1 )] << get title );
	hlb2 = H List Box();
	hlb2 << append( Report( obj[i] )[Picture Box( 1 )] );
	ob << set title(
		Char( Report( obj[i] )[Outline Box( 1 )] << get title ) || " & " || Char( Report( obj[i + 1] )[Outline Box( 1 )] << get title )
	);
	Try( hlb2 << append( Report( obj[i + 1] )[Picture Box( 1 )] ) );
	hlb1 << append( hlb2 << get picture );
	vlb << append( ob );
);
obj << delete;

jour << Save Presentation( "fitness_logistic.pptx" );
Jim

View solution in original post

2 REPLIES 2
Highlighted
txnelson
Super User

Re: How to save journal as PPT (2 graphs per slide) using JSL

Here is a modification of your script that produces the graphs at two graphs per page.  It does this by creating a picture of the 2 graphs, and then adding that to the journal, not the original graphs.

ppt.PNG

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Fitness.jmp" );
obj = Logistic( invisible, Y( :Name ), X( :RstPulse ), By( :Age ) );
jour = New Window( "The Journal", <<journal, vlb = V List Box() );

// Loop through the outputs and put them into the journal
// as an Outline Box....to set the title
// and a picture of 2 of the logistic plots
// If the number of plots produced is an odd number, then
// don't allow the script to error out by using Try() on the second
// graphs in each loop
For( i = 1, i <= N Items( obj ), i = i + 2,
	ob = Outline Box( "OB", hlb1 = H List Box() );
	ob << set title( Report( obj[i] )[Outline Box( 1 )] << get title );
	hlb2 = H List Box();
	hlb2 << append( Report( obj[i] )[Picture Box( 1 )] );
	ob << set title(
		Char( Report( obj[i] )[Outline Box( 1 )] << get title ) || " & " || Char( Report( obj[i + 1] )[Outline Box( 1 )] << get title )
	);
	Try( hlb2 << append( Report( obj[i + 1] )[Picture Box( 1 )] ) );
	hlb1 << append( hlb2 << get picture );
	vlb << append( ob );
);
obj << delete;

jour << Save Presentation( "fitness_logistic.pptx" );
Jim

View solution in original post

Highlighted
simon_2
Level II

Re: How to save journal as PPT (2 graphs per slide) using JSL

This works great. Thanks Jim.

Article Labels