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
viskovicz00012
Level II

append in ppt

Help- - how to append my for loop of producing of correlation plots from which each slide contains 4 plots?

For( i = 1, i <= N Items( new_b ), i++,
				
				Bivariate(
					Y( Column( cor_tab, new_b[i] ) ),
					X( Column( cor_tab, ref_b[i] ) )));
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: append in ppt

JMP saving to PowerPoint will copy each individual graph to a separate slide.  Therefore, the below script groups the graphs into 2x2 groupings as a separate Picture object, and then saves those to PowerPoint.

Names default to here(1);
cor_tab=open("$SAMPLE_DATA/semiconductor capability.jmp");

new_b = cor_tab << get column names(string, continuous);
remove from(new_b,1,1);
ref_b = cor_tab << get column names(string, continuous);

// Create a Journal to temporally hold the graphs
nwj = new window("Graphs", <<journal);

// Loop across the columns specified in the new_b list
For( i = 1, i <= N Items( new_b ), i++,
	// If this is the first of 4 graphs, create an object
	// to hold the graphs.  In this case, a linup box that
	// has 2 columns.  Four graphs, when passed to it will
	// be placed into a 2 column by 2 row display
	If( Mod( i, 4 ) == 1,
		fourby = Lineup Box( N Col( 2 ) )
	);
		
	// Run the Bivariate		
	biv = Bivariate( Y( Column( cor_tab, new_b[i] ) ), X( Column( cor_tab, ref_b[i] ) ) );
	
	// Take the output from the bivariate and place it in the outline box
	fourby << append( Report( biv )[Outline Box( 1 )] );
	
	// Close the no longer needed Bivariate report
	biv << close window;
	
	// If 4 graphs have been run or if this is the last graph,
	// it is time to move the outline box to the journal.  
	// If the outline box was copied directly to the journal,
	// it would be copied as a 2x2, but there would be 4 separate
	// graphs, and when the journal is saved to PowerPoint, JMP
	// would save each graph to a separate slide.  Therefore, the
	// 2x2 is converted to a single picture as it is moved to 
	// the journal.
	If( Mod( i, 4 ) == 0 | i == N Items( new_b ),
		nwj << append( fourby << get picture )
	);
);

// Save the journal as a PowerPoint 
nwj << Save Presentation("$TEMP\the fourby charts.pptx");

// Close the no longer needed journal
nwj << close window;

// Display the PowerPoint slides
open("$TEMP\the fourby charts.pptx");
Jim

View solution in original post

1 REPLY 1
Highlighted
txnelson
Super User

Re: append in ppt

JMP saving to PowerPoint will copy each individual graph to a separate slide.  Therefore, the below script groups the graphs into 2x2 groupings as a separate Picture object, and then saves those to PowerPoint.

Names default to here(1);
cor_tab=open("$SAMPLE_DATA/semiconductor capability.jmp");

new_b = cor_tab << get column names(string, continuous);
remove from(new_b,1,1);
ref_b = cor_tab << get column names(string, continuous);

// Create a Journal to temporally hold the graphs
nwj = new window("Graphs", <<journal);

// Loop across the columns specified in the new_b list
For( i = 1, i <= N Items( new_b ), i++,
	// If this is the first of 4 graphs, create an object
	// to hold the graphs.  In this case, a linup box that
	// has 2 columns.  Four graphs, when passed to it will
	// be placed into a 2 column by 2 row display
	If( Mod( i, 4 ) == 1,
		fourby = Lineup Box( N Col( 2 ) )
	);
		
	// Run the Bivariate		
	biv = Bivariate( Y( Column( cor_tab, new_b[i] ) ), X( Column( cor_tab, ref_b[i] ) ) );
	
	// Take the output from the bivariate and place it in the outline box
	fourby << append( Report( biv )[Outline Box( 1 )] );
	
	// Close the no longer needed Bivariate report
	biv << close window;
	
	// If 4 graphs have been run or if this is the last graph,
	// it is time to move the outline box to the journal.  
	// If the outline box was copied directly to the journal,
	// it would be copied as a 2x2, but there would be 4 separate
	// graphs, and when the journal is saved to PowerPoint, JMP
	// would save each graph to a separate slide.  Therefore, the
	// 2x2 is converted to a single picture as it is moved to 
	// the journal.
	If( Mod( i, 4 ) == 0 | i == N Items( new_b ),
		nwj << append( fourby << get picture )
	);
);

// Save the journal as a PowerPoint 
nwj << Save Presentation("$TEMP\the fourby charts.pptx");

// Close the no longer needed journal
nwj << close window;

// Display the PowerPoint slides
open("$TEMP\the fourby charts.pptx");
Jim

View solution in original post

Article Labels

    There are no labels assigned to this post.