cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
Rishabh
Level I

Save two graphs in one slide of presentation

Hello,

1. I want to know how to save two graphs into one slide of ppt. 

Right now the my script is saving one graph per slide to ppt. 

I need to compare two graphs in single slide. Also, i generate like 100 graphs for my data and having 100 slides in ppt makes hard to analyse. 

2. how to scale my individuals graphs?


//******************Open Data table***********************//

dt = Open( "$Downloads\Measure - Subset of JA63025.10A_raw_para_Stacked.jmp" );

//************************ Create new Columns to segregate the test names to group and plot graphs ***********************//

dt << New Column( "Test Number (MSB of Label)",
	Character,
	Nominal,
	Formula( Num( Substr( :Label, Contains( :Label, ":p" ) - Num( 10 ), Contains( :Label, ":p" ) - Num( 6 ) ) ) )
);
dt << New Column( "Test Description", Character, Nominal, Formula( Substr( :Label, Contains( :Label, ":NVM_" ) + Num( 5 ), 100 ) ) );
dt << New Column( "NVM Parameter Name",
	Character,
	Nominal,
	Formula( Substitute/*###*/(Substr( :Label, Contains( :Label, ":NVM_" ) + Num( 5 ), 100 ), "[1]", "") )
);
dt << New Column( "Measurements.",
	Character,
	Nominal,
	Formula(
		If( 16600 <= :Name( "Test Number (MSB of Label)" ) <= 16603,
			Substitute( :Test Description, "[1]", "_BiasA_Pre_refcell_Erase" ),
			If( 16629 <= :Name( "Test Number (MSB of Label)" ) <= 16632,
				Substitute( :Test Description, "[1]", "_BiasA_Post_refcell_Erase" )
			)
		)
	)
);
dt << New Column( "Measurements..",
	Character,
	Nominal,
	Formula( If( 10100 <= :Name( "Test Number (MSB of Label)" ) <= 10103, Substitute( :Test Description, "[1]", "" ) ) )
);
dt << New Column( "Measurements...",
	Character,
	Nominal,
	Formula(
		If( 10100 <= :Name( "Test Number (MSB of Label)" ) <= 10103,
			Empty(),
			If( 16600 <= :Name( "Test Number (MSB of Label)" ) <= 16603,
				Empty(),
				If( 16629 <= :Name( "Test Number (MSB of Label)" ) <= 16632,
					Empty(),
					Substitute( :Test Description, "[1]", "" )
				)
			)
		)
	)
);

//*******************Plot Variability Charts****************************//

dtsum = Current Data Table();

colnames = dtsum << get column names( character );

Show( colnames );
//nw = New Window( "Plots", myVLB = V List Box() );

New Window( "Graphs",
	For( i = 23, i <= N Items( colnames ), i++, //  We have change i value based on the column where our modified column to plot graphs starts

		gb = Variability Chart(
			invisible,
			Y( :Data ),
			Y Scale( Left, Right ),
			X( Column( colnames[i] ) ),
			Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
			Vertical Charts( 0 ),
			Variability Summary Report( 1 ),
			Std Dev Chart( 0 ),
			Mean of Std Dev( 0 ),
			Show Box Plots( 1 ),
			Mean Diamonds( 1 ),
			By( :NVM Parameter Name ), 

		);
	
	);
	//myVLB << append( Report( gb ) );
);

//**********************************Save Script to Data Table ************************//

dt << New script(
	"Plots",
	For( i = 23, i <= N Items( colnames ), i++, //  We have change i value based on the column where our modified column to plot graphs starts
		Variability Chart(
			//invisible,
			Y( :Data ),
			Y Scale( Left, Right ),
			X( Column( colnames[i] ) ),
			Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
			Vertical Charts( 0 ),
			Variability Summary Report( 1 ),
			Std Dev Chart( 0 ),
			Mean of Std Dev( 0 ),
			Show Box Plots( 1 ),
			Mean Diamonds( 1 ),
			By( :NVM Parameter Name ), 

		);

	)
);


//*****************************************EXPORT GRAPHS TO PPT**********************************// 

For( i = 23, i <= N Items( colnames ), i++, //  We have change i value based on the column where our modified column to plot graphs starts

	nn = dt << Variability Chart(
		invisible,
		Y( :Data ),
		Y Scale( Left, Right ),
		X( Column( colnames[i] ) ),
		By( :NVM Parameter Name ),
		Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
		Vertical Charts( 0 ),
		Variability Summary Report( 0 ),
		Std Dev Chart( 0 ),
		Mean of Std Dev( 0 ),
		Show Box Plots( 1 ),
		Mean Diamonds( 1 ), 

	);
	
	If( i == 23,
		nn << Save Presentation( "$Downloads/jmp_example2.pptx" ),
		nn << Save Presentation( "$Downloads/jmp_example2.pptx", Append )
	);
);

Open( "$Downloads/jmp_example2.pptx" );




2 ACCEPTED SOLUTIONS

Accepted Solutions
Byron_JMP
Staff

Re: Save two graphs in one slide of presentation

Just a suggestion:

Stack the three Measurements columns and then make this figure in graph builder.

Its all the figures on one slide.

 

Graph Builder.png

 

JMP Systems Engineer, Health and Life Sciences (Pharma)

View solution in original post

txnelson
Super User

Re: Save two graphs in one slide of presentation

The method I use is to create the slides as I want them to be within JMP, and then copy them as pictures into a final display window, one picture object for each pptx page I want.

Below is a script that shows a simple example.

Names default to here(1);
dt=Open("$SAMPLE_DATA/big class.jmp");

// Create the 2 graphs
fg = dt << Fit Group(
	Oneway(
		Y( :height ),
		X( :sex ),
		SendToReport(
			Dispatch( {}, "Oneway Plot", FrameBox, {Frame Size( 463, 305 )} )
		)
	),
	Oneway(
		Y( :weight ),
		X( :sex ),
		SendToReport(
			Dispatch( {}, "Oneway Plot", FrameBox, {Frame Size( 463, 305 )} )
		)
	),
	<<{Arrange in Rows( 1 )}
);

// Place the graphs into a single picture
nw=new window("The Picture", report(fg)[outlinebox(1)]<<get picture);
fg<<close window;

// Save the single picture to pptx
nw<<save presentation("$TEMP/thepicture.pptx");

open("$TEMP/thepicture.pptx");
Jim

View solution in original post

9 REPLIES 9
Byron_JMP
Staff

Re: Save two graphs in one slide of presentation

Just a suggestion:

Stack the three Measurements columns and then make this figure in graph builder.

Its all the figures on one slide.

 

Graph Builder.png

 

JMP Systems Engineer, Health and Life Sciences (Pharma)
txnelson
Super User

Re: Save two graphs in one slide of presentation

The method I use is to create the slides as I want them to be within JMP, and then copy them as pictures into a final display window, one picture object for each pptx page I want.

Below is a script that shows a simple example.

Names default to here(1);
dt=Open("$SAMPLE_DATA/big class.jmp");

// Create the 2 graphs
fg = dt << Fit Group(
	Oneway(
		Y( :height ),
		X( :sex ),
		SendToReport(
			Dispatch( {}, "Oneway Plot", FrameBox, {Frame Size( 463, 305 )} )
		)
	),
	Oneway(
		Y( :weight ),
		X( :sex ),
		SendToReport(
			Dispatch( {}, "Oneway Plot", FrameBox, {Frame Size( 463, 305 )} )
		)
	),
	<<{Arrange in Rows( 1 )}
);

// Place the graphs into a single picture
nw=new window("The Picture", report(fg)[outlinebox(1)]<<get picture);
fg<<close window;

// Save the single picture to pptx
nw<<save presentation("$TEMP/thepicture.pptx");

open("$TEMP/thepicture.pptx");
Jim
Byron_JMP
Staff

Re: Save two graphs in one slide of presentation

Jim, I was thinking the same thing, but, like in this case what if you don't know how many graphs there will be ahead of time.  How would you go about making n pairs of graphs?

JMP Systems Engineer, Health and Life Sciences (Pharma)
txnelson
Super User

Re: Save two graphs in one slide of presentation

How I typically handle this, is to have the script create the paired picture objects as they are being created.  And then append them to the journal.  So in the above case where multiple Variability Charts are being created, I would create  a V List Box() or H List Box for loop iteration 1 and append the first iteration graph into the List Box(), and then in iteration loop 2, I would append the output into the List Box, and then copy a picture of the List Box to the journal window, and then delete the List Box(), and start over for iteration 3, etc.

 

One could also query the Journal after all of the Variability Charts are there, using XPath, and find out the number of Outline Boxes, and from there build your pairs and place them into a new journal window that can be your final Save Presentation output

 

And I am sure other methods are being used

Jim
MathStatChem
Level VI

Re: Save two graphs in one slide of presentation

What would be great is a display object (maybe call it "slidebox()"? ) that you can put display objects inside of it, and then everything in that container box is treated as one slide (or one page).  

txnelson
Super User

Re: Save two graphs in one slide of presentation

I actually think that functionality is already there.  I use Outline Boxes most of the time as your SlideBox().  I just build the outputs as I need them, and then place them into an Outline Box() and then append them to the Journal I am building.  The Outline Box() is chosen, because of the way JMP handles outline boxes with pptx files.  The Outline Box() title becomes the title of the slide, and the "picture" I have placed into the outline box() becomes the content of the slide.

 

Yes there could be some defaults set for a "SlideBox()" that might make it easier, but most of the time, the combinations of objects that I put together require multiple H List Boxes, V List Boxes, Lineup Boxes, etc to get the display as I want it.

Jim
MathStatChem
Level VI

Re: Save two graphs in one slide of presentation

I think the issue is when you outline boxes inside outline boxes.  I've tried that and saving to powerpoint gives mixed results.  

txnelson
Super User

Re: Save two graphs in one slide of presentation

The key to this, is that all outline boxes that are within the outline box, have to be copied in as one picture. You need to create your desired page using whatever structure you need, and the final step, is to append that desired page using << get picture, into the outline box you are going to << Save Presentation from.

Jim
Byron_JMP
Staff

Re: Save two graphs in one slide of presentation

Very good point. That's not something that's implicitly obvious, Thanks

JMP Systems Engineer, Health and Life Sciences (Pharma)