Exporting multiple Graphs with different scriptsHey Jmp users,
I am trying to export multiple graphs in Jmp. Is there anyway to select the corresponding scripts and export all the graphs together.
Thanks a lot !
I
Automation and ScriptingMass CustomizationRe: Exporting multiple Graphs with different scriptspmroz,
I'm still getting a blank window when trying to open "Graph". Is there something fundamental that I need to include? My objective is to put all three plots (Graphs, Graphs2 and Graphs3) into one window so I can copy and paste into Powerpoint.
Many thanks for any input.
Neil
Re: Exporting multiple Graphs with different scriptspmroz,
Many thanks for the input! Being a novice, I'm still getting use to JSL flow and functionality, and would be glad for expert guidance. I included the entire script (pared down), to show you the overall flow. Based on previous coding experience which considered a main macro and subroutines, I was trying to encapsulate routines in expressions so they could be called later in program ("Files()", "Join_files", and "Con").
I changed "Graphs = Eval Expr" to "Graphs = Expr", and everything works. I wasn't sure if this needed an Eval since it was called in another expression (Join_files).
I had used graphs in new window, but still get an empty window.
Many thanks again for your valuable time.
Neil
Files = Expr(
SD1 = "C:\Users\";
path = {};
f1 = Files In Directory( SD1, recursive(1));
For( i = 1, i <= N Items( f1 ), i++,
If(Ends With( f1[i], ".csv" ),
f1[i] = Convert File Path(SD1) || f1[i];
b= f1[i];
Insert Into(path, b)
);
);
);
Join_files = Expr(
For( i = 1, i <= N Items( path ), i+=2,
/*area, %area, and pore pixel count*/
jointable1 = Open( path[i] );
//jointable1 << Get Name;
samplename = Substr( jointable1 << Get Name, 1, 18 ); //sample replicate name //
samplename2 = Word(1,q, "_"); // only sample name, no replicate suffix
jointable1 << New Column( "Sample",
Character,
Nominal,
Set Each Value( samplename ) // setting each row in column 1 to samp rep name //
);
jointable2 = Open( path[i + 1] );
dt = Data Table( jointable1 ) << Join(
With( Data Table( jointable2 ) ),
Select( :Sample, :Area, :Name( "%Area" ),:scale,:thick),
SelectWith( :pixD1, :count1),
Cartesian Join
);
Close( jointable1, no save );
Close( jointable2, no save );
Columns();
Graphs();
Graphs2();
Graphs3();
dt << Set Name(samplename);
po = dt << get name;
dt << Save(SD1 || po);
);
nw = new window("Example Export Multiple Platforms",
chart_output = vlistbox(
graphs,
);
);
);
Columns = Eval Expr(
dt << New Column( "Sample 2",
Character,
"Nominal",
Set Each Value(samplename2),
Set Display Width( 150 ),
);
);
Graphs = Eval Expr(
/*set graphs*/
dt << New Table Property( "Cumulative Resistivity",
Graph Builder(
Size( 591, 496 ),
Show Control Panel( 0 ),
Grid Color( "Black" ),
Graph Spacing( 2 ),
Variables(
X( :Name( "Diameter (um)" ) ),
Y( :Name( "flow resistivity (Pa*s/m^2)") ),
Overlay( :Sample )
),
Elements( Position( 1, 1 ), Line( X, Y, Legend( 20 ) ) ),
SendToReport(
Dispatch(
{},
"Diameter (um)",
ScaleBox,
{Min( 0 ), Max( 80 ), Inc( 1 ), Minor Ticks( 1 ),
Label Row(
{Show Major Grid( 1 ), Show Minor Grid( 1 )}
)}
),
Dispatch(
{},
"flow resistivity (Pa*s/m^2)",
ScaleBox,
{Scale( "Log" ), Format( "Scientific", 12 ), Min( 100000 ),
Max( 10000000000000 ), Inc( 1 ), Minor Ticks( 1 ),
Label Row( {Show Major Grid( 1 ), Show Minor Grid( 1 )} )}
),
)
)
)
);
Con = Expr(
dt = {};
// Sort list ascending (sample replicates) //
For( i = 1, i <= N Table(), i++,
table = data table(i);
insert into(dt, table);
sort list into(dt)
);
// Concatenate each file (sample replicates) //
dt_all= Data Table( dt[1] ) << Concatenate(
Data Table( dt[2] ),
Data Table( dt[3] ),
Output Table( "Concatenated Table" )
);
// Rename file to sample name and Save //
dt_all << set name(samplename2);
dt_all:Sample << Set Display Width( 150 ); // Widen to include entire title
p = dt_all << get name;
dt_all << Save(SD1 || p);
close(dt_all, no save);
close(dt[1], no save);
close(dt[2], no save);
close(dt[3], no save);
);
Files();
Join_files();
Con();
Re: Exporting multiple Graphs with different scriptsHi NRW - I think you are over complicating things somewhat. You don't need to put your join logic into an expression. Just run it as is without the surrounding expr().
The graphs logic got cut off in your posting, but that I would do as expr(), rather than eval expr().
Finally in your new window just put
graphs,
and not
graphs("Cumulative Resistivity"),
Re: Exporting multiple Graphs with different scriptsFolks,
I just stumbled upon this thread, and I think it is what I've been after. However, I'm still trying to get over the JSL learning hump and I can't quite get the result.
Quick summary:
- merged CSV data sets into one JMP sheet
- created and saved plot scripts to data table
- When opening table at a later point, I run the the three plot scripts, then I copy and paste each plot into a single Powerpoint slide (images that correspond to plots have been pasted already in same slide)
I'm looking to minimize the click and copy steps by at least pooling all three graphs together and get them in a format that can export all three at the same time. I've been exploring if this needs to be done with a Dashboard or Journal which somehow groups and saves as a file I can pull over. The holy grail would be to have my jpg images mated with my JMP plots and then brought over to PP.
I have tried the Vlist command but get an empty window when trying to get the plot that was saved as a script. Part of the relevant script pieces are shown.
Any thoughts or input are welcome.
Neil
Join_files = Expr(
For( i = 1, i <= N Items( path ), i+=2,
/*area, %area, and pore pixel count*/
jointable1 = Open( path[i] );
//jointable1 << Get Name;
samplename = Substr( jointable1 << Get Name, 1, 18 ); //sample replicate name //
samplename2 = Word(1,q, "_"); // only sample name, no replicate suffix
jointable1 << New Column( "Sample",
Character,
Nominal,
Set Each Value( samplename ) // setting each row in column 1 to samp rep name //
);
/*diameter and pore pixel count*/
jointable2 = Open( path[i + 1] );
dt = Data Table( jointable1 ) << Join(
With( Data Table( jointable2 ) ),
Select( :Sample, :Area, :Name( "%Area" ),:scale,:thick),
SelectWith( :pixD1, :count1),
Cartesian Join
);
Close( jointable1, no save );<SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="report summ_.JPG" style="width: 829px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="report summ_.JPG" style="width: 829px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="report summ_.JPG" style="width: 829px;"><span class="lia-inline-image-display-wrapper" image-alt="report summ_.JPG" style="width: 829px;"><img src="https://us.v-cdn.net/6038925/uploads/images/32980i018D050D35ACCDD9/report%20summ_.JPG" role="button" title="report summ_.JPG" alt="report summ_.JPG" /></span></SPAN></SPAN></SPAN>
Close( jointable2, no save );
Columns();
Graphs();
Graphs2();
Graphs3();
dt << Set Name(samplename);
po = dt << get name;
dt << Save(SD1 || po);
);
<BR />Graphs = Eval Expr(<BR />/*set graphs*/<BR />dt << New Table Property( "Cumulative Resistivity",<BR />Graph Builder(<BR />Size( 591, 496 ),<BR />Show Control Panel( 0 ),<BR />Grid Color( "Black" ),<BR />Graph Spacing( 2 ),<BR />Variables(<BR />X( :Name( "Pore Diameter (um)" ) ),<BR />Y( :Name( "Cumulative flow resistivity (Pa*s/m^2)") ),<BR />Y( :Pore Size Dist ),<BR />Y( :Name( "Cumulative Pore fraction (pore+solid)" ) ),<BR />Overlay( :Sample )<BR />),<BR />Elements( Position( 1, 1 ), Line( X, Y, Legend( 20 ) ) ),<BR />Elements( Position( 1, 2 ), Line( X, Y, Legend( 18 ) ) ),<BR />Elements( Position( 1, 3 ), Line( X, Y, Legend( 19 ) ) ),<BR />SendToReport(<BR />Dispatch(<BR />...<BR />
nw = new window("Example Export Multiple Platforms",
chart_output = vlistbox(
graphs("Cumulative Resistivity"),
);
);
);
Re: Exporting multiple Graphs with different scriptsHi @JMPdiscoverer ,
I was coming up with a similar solution to @pmroz , and I like what they did.
Here's what I was thinking, but not as nice as making a word document, etc. You can also save them directly to PPT files as well. I created the reports in the JSL just to have them handy, but the for loops can work if you've already got them open. But, if you write a script that generates the reports, you can just reference the report by variable name instead of finding a list of windows.
Names Default To Here( 1 );
dt = open("$sample_data\Big Class.jmp");
rpt1 = dt << Bivariate( Y( :weight ), X( :height ) );
rpt2 = dt << Oneway( Y( :height ), X( :age ), X Axis Proportional( 0 ) );
rpt3 = dt << Fit Group(
Oneway( Y( :weight ), X( :age ), X Axis Proportional( 0 ) ),
Bivariate( Y( :weight ), X( :height ) ),
<<{Arrange in Rows( 2 )}
);
reportlist = {};
For( i = 0, i <= N Items( Window() ), i++,
If(
!Is Missing( Regex( Window( i ) << getwindow title, "Fit" ) ) == 1 | !Is Missing(
Regex( Window( i ) << getwindow title, "Oneway" )
) == 1 | !Is Missing( Regex( Window( i ) << getwindow title, "Bivariate" ) ) == 1,
Insert Into( reportlist, Window( i ) << get window title )
)
);
For( i = 1, i <= N Items( reportlist ), i++,
picbox = Window( reportlist[i] ) << getPicture;
picbox << SaveImage(
"whatever your local directory to save is\pic" || Char( i ) || ".png"
);
); These should get you working well on your way.
Good luck!,
DS
Re: Exporting multiple Graphs with different scriptsHere's an example that exports three graphical outputs from Big Class to a word doc.
dt = open("$sample_data\Big Class.jmp");
dist = expr(dt << Distribution(
Continuous Distribution( Column( :weight ) ),
Nominal Distribution( Column( :age ) )
));
gb1 = expr(dt << Graph Builder(
Show Control Panel( 0 ),
Variables( X( :age ), Y( :sex ) ),
Elements( Heatmap( X, Y, Legend( 2 ) ) )
));
gb2 = expr(dt << Graph Builder(
Show Control Panel( 0 ),
Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
));
nw = new window("Example Export Multiple Platforms",
chart_output = vlistbox(
dist,
page break box(),
gb1,
page break box(),
gb2
);
);
chart_output << save msword("c:\temp\SampleCharts.doc", Native);