<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: saving graphs as PNG or JPEG in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/saving-graphs-as-PNG-or-JPEG/m-p/34334#M20348</link>
    <description>Thank you txnelson for the reply. It was very useful. If I wanted to do a for loop in a data filter, is it possible to do it? That it can automatically go through each condition and plot the graphs. Like you suggested, I will look into the Addin feature in the scripting guide.</description>
    <pubDate>Tue, 10 Jan 2017 22:47:11 GMT</pubDate>
    <dc:creator>vishwasanj</dc:creator>
    <dc:date>2017-01-10T22:47:11Z</dc:date>
    <item>
      <title>saving graphs as PNG or JPEG</title>
      <link>https://community.jmp.com/t5/Discussions/saving-graphs-as-PNG-or-JPEG/m-p/34330#M20345</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have made a script which lets the user select an excel file, process it , add or formulates columsn to it, opens graph builder and plots it with local data filter.&lt;/P&gt;&lt;P&gt;My question is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. How do I save graphs choosing the local data filter option using the script? For example, I have 2 local data filters, say Trimset(10, 100, 101, 110, 111, 1000, 11111) and formula(yes or no) and I need to plot graphs like (All trimset values with formula NO) and (Each of the trimset values with formula YES) .. so a total of 8 graphs.&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;In my graph, I want the statement beneath the graph "Where Trimset is .... and formula is NO "&amp;nbsp;to be included.&lt;/P&gt;&lt;P&gt;3. Save graphs in a folder in png or jpeg files&lt;/P&gt;&lt;P&gt;4.JMP data table and graph builder tables exits without saving.&lt;/P&gt;&lt;P&gt;5. how to make an addin feature to make it a single click operation because I need to do this for 100 or more files?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been reading all the discussions but I am not able to get the right answer. I really appreciate your help.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2017 20:08:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/saving-graphs-as-PNG-or-JPEG/m-p/34330#M20345</guid>
      <dc:creator>vishwasanj</dc:creator>
      <dc:date>2017-01-10T20:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: saving graphs as PNG or JPEG</title>
      <link>https://community.jmp.com/t5/Discussions/saving-graphs-as-PNG-or-JPEG/m-p/34331#M20346</link>
      <description>&lt;P&gt;My first point, is that you should not be reading the Discussions to learn how to script JMP.&amp;nbsp; You should be reading the JSL Scripting Guide.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Help==&amp;gt;Books==&amp;gt;Scripting Guide&lt;/P&gt;
&lt;P&gt;Then if you can't get things to work, then the Discussion Community is a great resource to help you.&lt;/P&gt;
&lt;P&gt;Let me take a wack at the questions you ask.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp; How do you use a local data filter and then save the output.&lt;/P&gt;
&lt;P&gt;Below is a crude script that will show you how to do this in a very unfancy way&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt=Open(&amp;lt;path to your data table&amp;gt;);
gb=Graph Builder(
	Size( 527, 453 ),
	Show Control Panel( 0 ),
	Variables( X( :weight ), Y( :height ) ),
	Elements( Points( X, Y, Legend( 13 ) ), Smoother( X, Y, Legend( 14 ) ) )
);

Thefilter=gb&amp;lt;&amp;lt;Local Data Filter(
	Add Filter(
		columns( :age, :sex ),
		Where( :age == {12, 13, 14} ),
		Where( :sex == "F" ),
		Display( :age, Size( 170, 96 ), List Display )
	)
);

report(gb)&amp;lt;&amp;lt;save picture( "path/to/example.png", "png" );

gb&amp;lt;&amp;lt;remove local data filter;

Thefilter=gb&amp;lt;&amp;lt;Local Data Filter(
	Add Filter(
		columns(  :sex ),
		Where( :sex == "F" ),
		Display( :age, Size( 170, 96 ), List Display )
	)
);

report(gb)&amp;lt;&amp;lt;save picture( "path/to/example.png", "png" );

gb&amp;lt;&amp;lt;remove local data filter;


// Add the remaining filter cases

close(dt,nosave);
gb &amp;lt;&amp;lt; close window;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The code for the graph builder and each of the local filters is available under the red triangles.&amp;nbsp; If you select them and go to "Save Script" you will get the code required for the different cases you have.&amp;nbsp; Just start up Graph Builder.&amp;nbsp; Then save the script for the graph builder.&amp;nbsp; Then open the local filter.&amp;nbsp; Set it to your first case(where clauses) and then save it's script.&amp;nbsp; Next, change the local filter to the next case and save it's script....etc.&lt;/P&gt;
&lt;P&gt;2. The statement below the graph is saved to the png&lt;/P&gt;
&lt;P&gt;3. You just need to specify in the Save Picture function the path.&amp;nbsp; This can be programatically handled so that it can follow any naming method you want to use.&lt;/P&gt;
&lt;P&gt;4. The sample script show the method to do this&lt;/P&gt;
&lt;P&gt;5. There is very good documentation in the Scripting Guide on how to make an Addin.&amp;nbsp; It is a far too lengthy answer to be handled in the Discussion&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2017 14:27:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/saving-graphs-as-PNG-or-JPEG/m-p/34331#M20346</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-01-11T14:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: saving graphs as PNG or JPEG</title>
      <link>https://community.jmp.com/t5/Discussions/saving-graphs-as-PNG-or-JPEG/m-p/34333#M20347</link>
      <description>&lt;P&gt;Here's a different approach, without using the data filter:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$sample_data/big class.jmp" );
ages = Data Table( "big class" ) &amp;lt;&amp;lt; Summary( Group( :age ), Freq( "None" ), Weight( "None" ) );
sexes = Data Table( "big class" ) &amp;lt;&amp;lt; Summary( Group( :sex ), Freq( "None" ), Weight( "None" ) );
deletedirectory("$temp/myPics");
createDirectory("$temp/myPics");
For( iage = 1, iage &amp;lt;= N Rows( ages ), iage++,
	thisAge = ages:age[iage];
	For( isex = 1, isex &amp;lt;= N Rows( sexes ), isex++,
		thisSex = sexes:sex[isex];
		eval(evalexpr(biv = dt &amp;lt;&amp;lt; Bivariate(
			Y( :weight ),
			X( :height ),
			Automatic Recalc( 1 ),
			Fit Line( {Line Color( {213, 72, 87} )} ),
			where( age == expr(thisAge) &amp;amp; sex == expr(thisSex) )
		)));
		parentBox = Report( biv ) &amp;lt;&amp;lt; parent;
		picture = parentBox &amp;lt;&amp;lt; getpicture;
		picture &amp;lt;&amp;lt; saveImage( "$temp/myPics/age" || Char( thisAge ) || "sex" || Char( thisSex ) || ".png", "png" );
		// optional: Open( "$temp/age" || Char( thisAge ) || "sex" || Char( thisSex ) || ".png" );
		biv&amp;lt;&amp;lt;closewindow;
	);
);
close(ages,"nosave");
close(sexes,"nosave");
show(filesInDirectory("$temp/myPics"));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Files In Directory("$temp/myPics") = {"age12sexF.png", "age12sexM.png", "age13sexF.png", "age13sexM.png", "age14sexF.png", "age14sexM.png", "age15sexF.png", "age15sexM.png", "age16sexF.png", "age16sexM.png", "age17sexF.png", "age17sexM.png"};&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="where clause above graph" style="width: 513px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/4752iBA9B4BAA535B3639/image-size/large?v=v2&amp;amp;px=999" role="button" title="where.PNG" alt="where clause above graph" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;where clause above graph&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;In this case the where clause is above the platform's output, so I used the &amp;lt;&amp;lt;parent method to move up through the displaybox tree to include that outer box as well.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2017 22:04:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/saving-graphs-as-PNG-or-JPEG/m-p/34333#M20347</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2017-01-10T22:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: saving graphs as PNG or JPEG</title>
      <link>https://community.jmp.com/t5/Discussions/saving-graphs-as-PNG-or-JPEG/m-p/34334#M20348</link>
      <description>Thank you txnelson for the reply. It was very useful. If I wanted to do a for loop in a data filter, is it possible to do it? That it can automatically go through each condition and plot the graphs. Like you suggested, I will look into the Addin feature in the scripting guide.</description>
      <pubDate>Tue, 10 Jan 2017 22:47:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/saving-graphs-as-PNG-or-JPEG/m-p/34334#M20348</guid>
      <dc:creator>vishwasanj</dc:creator>
      <dc:date>2017-01-10T22:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: saving graphs as PNG or JPEG</title>
      <link>https://community.jmp.com/t5/Discussions/saving-graphs-as-PNG-or-JPEG/m-p/34335#M20349</link>
      <description>&lt;P&gt;Yes, a For loop is available.&amp;nbsp; JSL is a very complete language, with all of the functionality one would expect from a computer language.&lt;/P&gt;
&lt;P&gt;I suggest that you read the first few chapters of the Scripting Guide, so you can get a feeling for all of the components of the language and how to implement them.&lt;/P&gt;
&lt;P&gt;If you could give me a little information about what computer languages you work with, it would help me in providing you with JSL examples in terms that you are familiar with.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2017 23:06:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/saving-graphs-as-PNG-or-JPEG/m-p/34335#M20349</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-01-10T23:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: saving graphs as PNG or JPEG</title>
      <link>https://community.jmp.com/t5/Discussions/saving-graphs-as-PNG-or-JPEG/m-p/667064#M85509</link>
      <description>&lt;P&gt;This code adds a small menu to any Data Filter&amp;nbsp;&lt;SPAN&gt;- select your columns and click OK to cycle through the entries and auto-save the GraphBuilder plot.&lt;BR /&gt;(columns with continuous values are not listed)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1691597841172.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/55687i3811A898A4EE1E88/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1691597841172.png" alt="hogi_0-1691597841172.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to HERE(1);

if(not(namespaceExists("autoAnimate")),New NameSpace("autoAnimate"));

autoAnimate:update = function({},
Try (autoAnimate:DFTopLB = Current Report()["Local Data Filter", List Box( 1 )], stop());
Try(autoAnimate:myDFTPBs = (Current Report()["Local Data Filter", Lineup Ruler Box( 1 ), List Box( 1 )] &amp;lt;&amp;lt; Xpath( "//TabPageBox" )),stop());



// collect Data Fitlers with ListBoxes, remove the continuos ones.
autoAnimate:myDFLBs ={};
For Each ( {TPB,i}, autoAnimate:myDFTPBs, tmp=(TPB &amp;lt;&amp;lt; xpath( "//ListBoxBox" ));If(NItems(tmp),Insert Into(autoAnimate:myDFLBs,tmp[1]),Remove from(autoAnimate:myDFTPBs,i) )); 

// which columns are used?
autoAnimate:DFCols = Transform Each( {TPB}, autoAnimate:myDFTPBs, Trim( Word( 1, TPB &amp;lt;&amp;lt; Get Title, "(" ) ) );

// what are the entries? (for the filename)
autoAnimate:myDFLBItems = autoAnimate:myDFLBs &amp;lt;&amp;lt; get items;

// how many entries?
autoAnimate:myDFLBNItems = Transform Each( {items}, autoAnimate:myDFLBItems, N Items( items ) );

// variales for the for loops
chars = {"aa", "bb", "cc", "dd", "ee", "ff", "gg", "hh", "ii"};

// append a Display Box:
Try(autoAnimate:animatePane &amp;lt;&amp;lt; delete);
autoAnimate:DFTopLB &amp;lt;&amp;lt; append( autoAnimate:animatePane = V List Box (Spacer Box( size( 0, 20 ) ),Panel Box( "cycle selected + save", V List Box( colSelection = List Box( autoAnimate:DFCols ), H List Box( Button Box("update",autoAnimate:update()),Spacer Box (size(40,0)),Button Box( "start", autoAnimate:animateNsave() ) )) ) ));
);

autoAnimate:animateNsave = Function( {},

// which DFs are selected?
	selectedCols = colselection &amp;lt;&amp;lt; Get Selected Indices;
	
// compose the expression
	expression = "";
	xx=1;
// for loop for every active DF:
	For( i = 1, i &amp;lt;= N Items( autoAnimate:myDFTPBs ), i++,
		expression = expression || If( Contains( selectedCols, i ),
			"For(" || chars[i] || "=1," || chars[i] || "&amp;lt;=" || Char( autoAnimate:myDFLBNItems[i] ) || "," || chars[i] || "++,__LB" || Char( i ) ||
			"__ &amp;lt;&amp;lt; clear selection &amp;lt;&amp;lt; set selected(" || chars[i] || ");",
			"if(1,"
		)
	);
// save current Graph builder Plot -- how about other reports?
	expression = expression || "wait();(current report()&amp;lt;&amp;lt; XPath(\!"//OutlineBox[@helpKey='Graph Builder']\!"))&amp;lt;&amp;lt;Save Picture(\!"C:\temp\\!"";
	
// compose the correct filename
	For( i = 1, i &amp;lt;= N Items( autoAnimate:myDFTPBs ), i++, expression = expression ||If( Contains( selectedCols, i ), "||\!""||Char (autoAnimate:DFCols[i])||"=\!"||Char("||Char(autoAnimate:myDFLBItems[i])||"["||chars[i]||"])||\!"_\!"","||\!"_\!""));

	expression = expression || "||\!".png\!")";
	For( i = 1, i &amp;lt;= N Items( autoAnimate:myDFTPBs ), i++,
		expression = expression || ")"
	);
	expression = Parse(expression);
	For( i = 1, i &amp;lt;= N Items( autoAnimate:myDFTPBs ),i++,expression = Substitute(Name Expr(expression ),Parse("__LB"|| Char( i ) ||"__"),autoAnimate:myDFLBs[i]));
	//Name Expr(expression )
	Eval(expression);
	Open("C:\temp");
);

autoAnimate:update();&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Oct 2023 04:57:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/saving-graphs-as-PNG-or-JPEG/m-p/667064#M85509</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-10-06T04:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: saving graphs as PNG or JPEG</title>
      <link>https://community.jmp.com/t5/Discussions/saving-graphs-as-PNG-or-JPEG/m-p/818293#M99687</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/26800"&gt;@hogi&lt;/a&gt;,&amp;nbsp;this script is awesome! I share my analysis results with many coworkers w/o JMP and having this menu added to graphs with a local data filter is very helpful.&amp;nbsp;&lt;/P&gt;&lt;P&gt;*It might be helpful for beginners to note that &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/26800"&gt;@hogi&lt;/a&gt;'s script is standalone and can be added to a data table (by using the red triangle at the top of the left panel in your data table and select "New Script"). Then when you run this script, it will add the small menu to the current active report that already has a local data filter applied.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 16:53:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/saving-graphs-as-PNG-or-JPEG/m-p/818293#M99687</guid>
      <dc:creator>jwiltsie</dc:creator>
      <dc:date>2024-11-22T16:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: saving graphs as PNG or JPEG</title>
      <link>https://community.jmp.com/t5/Discussions/saving-graphs-as-PNG-or-JPEG/m-p/818301#M99688</link>
      <description>&lt;P&gt;It just got easier&amp;nbsp; : )&lt;BR /&gt;I added the functionality to the&amp;nbsp;&lt;LI-MESSAGE title="Graph Builder Toolbar" uid="565466" url="https://community.jmp.com/t5/JMP-Add-Ins/Graph-Builder-Toolbar/m-p/565466#U565466" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp; *)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*) now available via the marketplace:&lt;BR /&gt;&lt;A href="https://marketplace.jmp.com/appdetails/Graph%20Builder%20Toolbar" target="_blank"&gt;https://marketplace.jmp.com/appdetails/Graph%20Builder%20Toolbar&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1732294880922.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/70531i7758EF97399DD91D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1732294880922.png" alt="hogi_0-1732294880922.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 17:02:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/saving-graphs-as-PNG-or-JPEG/m-p/818301#M99688</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-11-22T17:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: saving graphs as PNG or JPEG</title>
      <link>https://community.jmp.com/t5/Discussions/saving-graphs-as-PNG-or-JPEG/m-p/818303#M99689</link>
      <description>&lt;P&gt;... but still the version with the same bug.&lt;BR /&gt;&lt;BR /&gt;If you want to speed it up, please change the argument of &lt;FONT face="courier new,courier"&gt;wait()&lt;/FONT&gt; from () to (&lt;FONT face="courier new,courier"&gt;0)&lt;/FONT&gt;:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_1-1732295076627.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/70532i80B85D26BB9F1B54/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_1-1732295076627.png" alt="hogi_1-1732295076627.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 17:05:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/saving-graphs-as-PNG-or-JPEG/m-p/818303#M99689</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-11-22T17:05:52Z</dc:date>
    </item>
  </channel>
</rss>

