I generated lots of pages from one graph. This is from graph builder.
I like to save each page as one image file. Is this possible in JMP?
Thanks,Dave
Yes, this is possible. If you want each graph builder chart saved as an image, it can be scripted for each graph builder chart (or collection of graph builder pages) respectively as:
gb << Journal();current journal() << Save Picture ("\\ImageSaveLocation\ImageName.PNG");current journal() << Close Window;
gb2 << Journal();current journal() << Save Picture ("\\ImageSaveLocation\ImageName2.PNG");current journal() << Close Window;
Maybe I don't understand your answer correctly @DMD . Let's say I have a graph builder gb which consists of several pages. Then
saves ONE image with all pages in it. But I want (and this is how I understood @davidmingyin ) several images with each page with its own image.
I would be really happy if someone can help. Many thanks in advance!
Hi @davidmingyin -
One way to do this without any scripting is to Export the report as a Powerpoint (File > Export...). To do this in Graph Builder, place a column in the "Page" drop zone. In other analysis platforms, assign a variable to the "By" column role.
When you Export as a Powerpoint, each individual graph will be exported as an image in a separate slide.
Good question. Here's the JSL that can crawl through the display tree to gather the pieces. The journal tree changed between 17 and 18 and might change again. You could probably do the 17 variation on the graphbuilder directly, but I found it easier to work with the journal, especially with the JMP 18 Early Adopter version.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" ); g = dt << Graph Builder( Size( 528, 2956 ), Show Control Panel( 0 ), Variables( X( :weight ), Y( :height ), Page( :age ) ), Elements( Points( X, Y, Legend( 5 ) ), Smoother( X, Y, Legend( 6 ) ) ) ); // make a journal just for this task, the vanilla journal might be in use. tempWindow = New Window( "temp", <<Type( "journal" ) ); g << journal; // place to save, be careful with delete directory!!!!!! dir = "$temp/" || "junk/"; // keep the trailing / to join a file name Delete Directory( dir ); // be careful here! this is really just for testing... Create Directory( dir ); If( JMP Version() >= "18", // easier in 18, the journal groups the pictures // moving the graphs to a journal window is the key; the elements are not // grouped by pages in a usable displaybox tree in graphbuilder, but they // are when graphbuilder sends them to a journal. // now use xpath to extract the chunks you want. In this case, using the // journal's showproperties, we discover there is a lineup box whose children // are what is needed. Get those children as a list... graphList = tempwindow << XPath( "//OutlineBox[text()='Graph Builder']//LineUpBox/ListBox" ); // save the pics; dig out a name for each one For Each( {graph}, graphList, // grab a name and keep the non-special characters for a disk file name label = Regex( graph[LabelBox( 1 )] << gettext, "[^A-Za-z0-9]+", "_", GLOBALREPLACE ); // create the individual picture using the label for a filename graph << savepicture( dir || label || ".png", "png" ); ); , // else harder in 17, find a way... // at least for this example we find pairs of listboxes, without a listbox wrapper as in 18 labList = tempwindow << XPath( "//OutlineBox[text()='Graph Builder']//BorderBox//LabelBox" ); For Each( {lab}, lablist, label = Regex( lab << gettext, "[^A-Za-z0-9]+", "_", GLOBALREPLACE ); parent = lab << parent; // use the journal's property sheet to see what is needed spacer = parent << sib; graph = spacer << sib; combine = V List Box( parent, graph ); combine << savepicture( dir || label || ".png", "png" ); ); ); // just for fun, see what happened fileList = Files In Directory( dir ); For Each( {file}, fileList, Open( dir || file ) );
Also, using by groups is about the same as the page option, and will make for easier solutions with xpath. To see the launcher that lets you use a by group in place of page, red-triangle->redo->relaunch
Graph builder also has this traditional launcher dialog, mostly not needed.
Also the by group version works with a data table to hold the graphs
The left-side data table was captured by the command on the right.