<?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: matplotlib on JMP graph builder in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/matplotlib-on-JMP-graph-builder/m-p/438610#M68727</link>
    <description>&lt;P&gt;I might misunderstand the desired outcome, but sounds like that you only need a data filter and a plot, not the drag-n-drop interactivity in Graph Builder (GB) and the complex graph layout within GB.&lt;/P&gt;
&lt;P&gt;If so, I believe that you at least need following ingredients:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;JSL function "Make Filter Change Handler", so you can get subsets of data based on the state of the data filter. See example for "Make Filter Change Handler" in Scripting Index.&lt;/LI&gt;
&lt;LI&gt;JSL function "Python Get Graphics", so you can get plot back from python. See example for "Python Get Graphics" in Scripting Index.&lt;/LI&gt;
&lt;LI&gt;A "Data Filter Context Box" display box to hold both the filter and your plot, and possibly other analysis together.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Here is a small example which puts the elements together.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA/Cities.jmp" );
New Window( "Shared Local Filter",
	Data Filter Context Box(
		H List Box(
			filter = (dt &amp;lt;&amp;lt; Data Filter( Local, Add Filter( columns( :Region ) ) )),
			pb = Picture Box()
		)
	)
);
f = Function( {nrows}, 
	rows = filter &amp;lt;&amp;lt; get filtered rows;
	xx = dt:X[rows];
	yy = dt:Y[rows];
	Python Init();
	Python Send(xx);
	Python Send(yy);
	ml = Python Submit(
		"\[
import matplotlib.pyplot as plt
plt.scatter(xx,yy)
plt.xlabel('X')
plt.ylabel('Y')
plt.show(block=False)
		]\"
	);
	plot = Python Get Graphics( png );
	pb &amp;lt;&amp;lt; set image(plot);
	Python Submit( "plt.close()" );
	Python Term();
);
rs = filter &amp;lt;&amp;lt; Make Filter Change Handler( f );

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Pay attention to Python's indentation rule. E.g. all strings in Python Submit must stick they fronts at the beginning of the lines.&lt;/P&gt;
&lt;P&gt;Here are a couple of screenshots of the product.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="peng_liu_0-1637373613101.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/37722i3094BBCC8FB4936B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peng_liu_0-1637373613101.png" alt="peng_liu_0-1637373613101.png" /&gt;&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="peng_liu_1-1637373625672.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/37723i824B2EFBCA0FF7D0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peng_liu_1-1637373625672.png" alt="peng_liu_1-1637373625672.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;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 20 Nov 2021 02:21:31 GMT</pubDate>
    <dc:creator>peng_liu</dc:creator>
    <dc:date>2021-11-20T02:21:31Z</dc:date>
    <item>
      <title>matplotlib on JMP graph builder</title>
      <link>https://community.jmp.com/t5/Discussions/matplotlib-on-JMP-graph-builder/m-p/438411#M68698</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi I'm trying to combine matplotlib and JMP graph builder, but I don't know if it is possible. I want to plot a particular graph that I only could plot on matplotlib; but I want to take the advantages about the JMP graph builder interface, like data filtering. It is possible to show a matplotlib plot over the JMP graph builder interface? Thanks in advance&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 11:19:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/matplotlib-on-JMP-graph-builder/m-p/438411#M68698</guid>
      <dc:creator>ziboltis</dc:creator>
      <dc:date>2023-06-11T11:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: matplotlib on JMP graph builder</title>
      <link>https://community.jmp.com/t5/Discussions/matplotlib-on-JMP-graph-builder/m-p/438460#M68704</link>
      <description>&lt;P&gt;A script could handle using a Data Filter, which triggers the matplotlib code and recreates the graph based upon the filtered data.&amp;nbsp; But I do not know of anyway to integrate Graph Builder with matplotlib.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2021 16:23:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/matplotlib-on-JMP-graph-builder/m-p/438460#M68704</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-11-19T16:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: matplotlib on JMP graph builder</title>
      <link>https://community.jmp.com/t5/Discussions/matplotlib-on-JMP-graph-builder/m-p/438610#M68727</link>
      <description>&lt;P&gt;I might misunderstand the desired outcome, but sounds like that you only need a data filter and a plot, not the drag-n-drop interactivity in Graph Builder (GB) and the complex graph layout within GB.&lt;/P&gt;
&lt;P&gt;If so, I believe that you at least need following ingredients:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;JSL function "Make Filter Change Handler", so you can get subsets of data based on the state of the data filter. See example for "Make Filter Change Handler" in Scripting Index.&lt;/LI&gt;
&lt;LI&gt;JSL function "Python Get Graphics", so you can get plot back from python. See example for "Python Get Graphics" in Scripting Index.&lt;/LI&gt;
&lt;LI&gt;A "Data Filter Context Box" display box to hold both the filter and your plot, and possibly other analysis together.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Here is a small example which puts the elements together.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA/Cities.jmp" );
New Window( "Shared Local Filter",
	Data Filter Context Box(
		H List Box(
			filter = (dt &amp;lt;&amp;lt; Data Filter( Local, Add Filter( columns( :Region ) ) )),
			pb = Picture Box()
		)
	)
);
f = Function( {nrows}, 
	rows = filter &amp;lt;&amp;lt; get filtered rows;
	xx = dt:X[rows];
	yy = dt:Y[rows];
	Python Init();
	Python Send(xx);
	Python Send(yy);
	ml = Python Submit(
		"\[
import matplotlib.pyplot as plt
plt.scatter(xx,yy)
plt.xlabel('X')
plt.ylabel('Y')
plt.show(block=False)
		]\"
	);
	plot = Python Get Graphics( png );
	pb &amp;lt;&amp;lt; set image(plot);
	Python Submit( "plt.close()" );
	Python Term();
);
rs = filter &amp;lt;&amp;lt; Make Filter Change Handler( f );

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Pay attention to Python's indentation rule. E.g. all strings in Python Submit must stick they fronts at the beginning of the lines.&lt;/P&gt;
&lt;P&gt;Here are a couple of screenshots of the product.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="peng_liu_0-1637373613101.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/37722i3094BBCC8FB4936B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peng_liu_0-1637373613101.png" alt="peng_liu_0-1637373613101.png" /&gt;&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="peng_liu_1-1637373625672.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/37723i824B2EFBCA0FF7D0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peng_liu_1-1637373625672.png" alt="peng_liu_1-1637373625672.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;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Nov 2021 02:21:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/matplotlib-on-JMP-graph-builder/m-p/438610#M68727</guid>
      <dc:creator>peng_liu</dc:creator>
      <dc:date>2021-11-20T02:21:31Z</dc:date>
    </item>
    <item>
      <title>Re: matplotlib on JMP graph builder</title>
      <link>https://community.jmp.com/t5/Discussions/matplotlib-on-JMP-graph-builder/m-p/438614#M68729</link>
      <description>&lt;P&gt;Amazing great example!&lt;/P&gt;
&lt;P&gt;If you use this example, be prepared to wait for Python to load after the first click; my slow machine might take 10-30 seconds. Once loaded, it is fast enough on subsequent clicks.&lt;/P&gt;</description>
      <pubDate>Sat, 20 Nov 2021 12:01:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/matplotlib-on-JMP-graph-builder/m-p/438614#M68729</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2021-11-20T12:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: matplotlib on JMP graph builder</title>
      <link>https://community.jmp.com/t5/Discussions/matplotlib-on-JMP-graph-builder/m-p/438622#M68730</link>
      <description>&lt;P&gt;This example needs to be added to the JMP Cookbook&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Nov 2021 14:50:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/matplotlib-on-JMP-graph-builder/m-p/438622#M68730</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-11-20T14:50:05Z</dc:date>
    </item>
  </channel>
</rss>

