Subscribe Bookmark RSS Feed

Two graphs to single PowerPoint slide

WendyLou315

Occasional Contributor

Joined:

Apr 13, 2017

Does anyone know how to send two graphs (3-D Surface Plots) to the same PowerPoint Slide?  I know how to get one there, but I need two, side-by-side.  I even know the size and position I want them on the slide, but I can't, for the life of me, figure out how to get them both there at one time.  Using Journal removes the text boxes and legend that must be included.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Here is an illustration of the concept that I am talking about.  I have intentionally avoided using "New Window"s to illustrate how this all can be put together without popping up windows all over the place.  If you want the display windows, you can just substitute them into the code

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );

// Create the desired graphs
biv1 = bivariate( invisible, x( :age ), y( :height ) );
biv2 = bivariate( invisible, x( :age ), y( :weight ) );

// Create a holding object to place them into
myhlb = H List Box();
// Copy the objects into the holding object
myhlb << append( Report( biv1 ) );
myhlb << append( Report( biv1 ) );

// Create a second holding object to copy the picture
// of the complete first holding object
myhlb2 = H List Box();

// Copy the picture
myhlb2 << append( myhlb << get picture );

// Save the second holding object to the ppt
myhlb2 << save presentation( "C:\mypicture.pptx" );
Jim
12 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

interactively or by using JSL(script)
Jim
WendyLou315

Occasional Contributor

Joined:

Apr 13, 2017

Sorry...neglected that detail...using jsl.  I'm developing a tool that produces multiple charts for production decision making and need two views of the same 3D surface plot on the same .pptx slide.

txnelson

Super User

Joined:

Jun 22, 2012

If you place the 2 outputs into an H List Box(), you can then capture them into another object with a << get picture.  The new object can be then saved to ppt

Jim
WendyLou315

Occasional Contributor

Joined:

Apr 13, 2017

Thanks again, Jim!  I now have a new window with the two graphs, and it looks perfect.  However, my problems continue.  This script produces multiple graphs that are inserted into the PowerPoint so I need to script what page each goes on *and* save each graph in a .png file.  When I try to send this object (the two surface plots) to the .ppt, nothing happens.  I've tried to send it to a report and I get errors every time. 

 

I'm a novice still trying to wrap my head around jsl structure.  With this problem I feel as I'm failing miserably.  I can't send you the full code, but up to this point is successful.  I've tried with and without the Repor() line.  What am I doing wrong?

//Save Slot Width Production 3-D Surface Plots to picture
Report(TippedSP)[PictureBox(1)] << save picture((outputloc || char(dienum) || "_ProductionTippedSW.png"), png);
Report(TopViewSP)[PictureBox(1)] << save picture((outputloc || char(dienum) || "_ProductionTopSW.png"), png);

LeftSP = TippedSP << Get Picture;
RightSP = TopViewSP << Get Picture;

SlideSurfacePlot = new window(" Test ", h list box( LeftSP, RightSP ) ) << Get Picture;

Report(SlideSurfacePlot)[PictureBox(1)] << Save Picture((outputloc || char(dienum) || "_Production3DSurface.png"), png);

SlideSurfacePlot << Save Presentation(outputloc || "_" || char(dienum) || "_04-27-2017_" || DieType || "_" || CCondition ||"_Summary_Production.pptx", Insert(5), PNG); 
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Here is an illustration of the concept that I am talking about.  I have intentionally avoided using "New Window"s to illustrate how this all can be put together without popping up windows all over the place.  If you want the display windows, you can just substitute them into the code

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );

// Create the desired graphs
biv1 = bivariate( invisible, x( :age ), y( :height ) );
biv2 = bivariate( invisible, x( :age ), y( :weight ) );

// Create a holding object to place them into
myhlb = H List Box();
// Copy the objects into the holding object
myhlb << append( Report( biv1 ) );
myhlb << append( Report( biv1 ) );

// Create a second holding object to copy the picture
// of the complete first holding object
myhlb2 = H List Box();

// Copy the picture
myhlb2 << append( myhlb << get picture );

// Save the second holding object to the ppt
myhlb2 << save presentation( "C:\mypicture.pptx" );
Jim
WendyLou315

Occasional Contributor

Joined:

Apr 13, 2017

Oh, that's AWESOME!  Works great.  Now if you know how to get it to size to the slide in ppt, I'd be done!  :-) 

 

Thank you SO much!  One day I'll get the nuances of jsl better.

txnelson

Super User

Joined:

Jun 22, 2012

try this on for size

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );

// Create the desired graphs
biv1 = bivariate( invisible, x( :age ), y( :height ) );
biv2 = bivariate( invisible, x( :age ), y( :weight ) );
report(biv1)[FrameBox(1)] << frame size(600,600);
report(biv2)[FrameBox(1)] << frame size(600,600);
// Create a holding object to place them into
myhlb = H List Box();
// Copy the objects into the holding object
myhlb << append( Report( biv1 ) );
myhlb << append( Report( biv1 ) );

// Create a second holding object to copy the picture
// of the complete first holding object
myhlb2 = H List Box();

// Copy the picture
myhlb2 << append( myhlb << get picture );

// Save the second holding object to the ppt
myhlb2 << save presentation( "C:\mypicture.pptx" );
Jim
WendyLou315

Occasional Contributor

Joined:

Apr 13, 2017

Thanks again, Jim! 

 

In theory that works.  For a general plot, works great.  Would the fact that I'm producing 3D Surface Plots invalidate "Frame Size"?  I'm getting the following error:

 

Cannot subscript Display Box in access or evaluation of 'Subscript' , Report( TippedSP )[/*###*/FrameBox( 1 )]

 

You've been a GREAT help today, I can't thank you enough!

- Wendy

txnelson

Super User

Joined:

Jun 22, 2012

What you are missing, is that FrameBox(1) isn't always the object that needs to be changed.  You need to read the section in the Scripting Guide on Display Trees.  If you are using Surface Plots, then the size of the object needs to deal with SceneBox(1), and it isn't a "Size" mesage, but rather a "Height" and "Width" measurement.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );

sur=Surface Plot(
	Columns( :age, :height, :weight ),
	Datapoints Choice( "Points" ),
	Surface Color Theme( "Green to Black to Red" ),
	Surface Color Theme2( "Green to White to Red" ),
	Surface Color Theme3( "White to Black" ),
	Surface Color Theme4( "Blue to Gray to Red" ),
	Response Column Color Theme( "Blue to Green to Red" ),
	Response Column Color Theme2( "Spectral" ),
	Response Column Color Theme3( "Jet" ),
	Response Column Color Theme4( "White to Blue" ),
	Response( :weight ),
	Surface Color Method( "Solid", "Solid", "Solid", "Solid" ),
	SetVariableAxis( :age, Axis Data( {} ) ),
	SetVariableAxis( :height, Axis Data( {} ) ),
	SetZAxis( weight, Current Value( 120 ) ),
	SetXVariable( :age ),
	SetYVariable( :height ),
	Frame3D( Set Rotation( -54, 0, 38 ) )
);
report(sur)[scenebox(1)]<<height(800)<<Width(800);
Jim