<?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 Get 3rd Y axis only for certain columns (working with loops) in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Get-3rd-Y-axis-only-for-certain-columns-working-with-loops/m-p/614215#M81423</link>
    <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got stuck on a problem and would be grateful for some advice:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We analyze samples and get population A, B, C, D and E for each sample.&lt;/P&gt;&lt;P&gt;The information for A can be divided into "%" and "count" , same for B,C,D and E.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We import the data and the columns named "A 1" to "E 1" represent the "%" values, the ones called "A 2" to "E 2" represent the "Count" values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since the import will always be the same, writing a script to generate graphs with 2 Y axis ("%" and "count") for each population type (A, B, C etc.) was manageable. See the code below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The Problem:&lt;/STRONG&gt; Sometimes we get an additional read out for some of our populations. E.g. only population B and E will have a third information called "fluorescence". These will be imported as columns "B 3" and "E 3" into the same table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since these populations may vary from import to import, I need to write a script which is able to identify "B 3" as a member of the "B"s and creates a 3rd Y axis in the population "B" graph (and the same for "E 3" in this example). But for this I am not smart/experienced enough.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of course, I tried to rearrange the table, create new rows instead of new columns and work with "wrap". But there we have no autoscale for each Y axis. Also tried an associate array for the three information types but failed due to the lack of coding experience.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe one of you has an idea, that could be helpful, thanks&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 );

dt = Current Data Table();
dt &amp;lt;&amp;lt; clear select; 

win = New Window( "Test", Outline Box( "", hb = V List Box() ) );

loopstart = Contains(dt &amp;lt;&amp;lt; get column names, Column("A 1"));
loopend = (Contains(dt &amp;lt;&amp;lt; get column names, Column("A 2")))-1;
icounts = (loopend+1)-loopstart; 

For( i = loopstart, i &amp;lt;= loopend, i++,
		
	
	gb = Graph Builder(
		Size( 1500, 900 ),
		Show Control Panel( 0 ),
		Grid Color( "Black" ),
		Graph Spacing( 2 ),
	
		Legend Position( "Bottom" ), 
	
		Variables( X( :Group ), Y( Eval( i ) ), Y( Eval( i + icounts ) ), Color( :Subjects ) ), 
		Elements( Position( 1, 1 ), Points( X, Y, Legend( 11 ) ), Box Plot( X, Y, Legend( 13 ) ) ), 
		Elements( Position( 1, 2 ), Points( X, Y, Legend( 12 ) ), Box Plot( X, Y, Legend( 14 ) ) ), 
		
	SendToReport(
			Dispatch( {}, "Graph Builder", OutlineBox, {Set Title( "DATA" ), Image Export Display( Normal )} ),
			Dispatch( {}, "graph title", TextEditBox, {Set Text( "Title" )}, {Set Font Size( 16 )} ),
			Dispatch( {}, "Y title", TextEditBox, {Set Font Size( 14 ), Set Font Style( "bold" ), Set Text( " [%]" )} ),
			Dispatch( {}, "Y1 title", TextEditBox, {Set Font Size( 14 ), Set Font Style( "bold" ), Set Text( " Count" )} ), 
			Dispatch( {}, "X title", TextEditBox, {Set Font Size( 14 ), Set Font Style( "bold" )} ), 
			
		
			Dispatch(
				{},
				"400",
				LegendBox,
				{Set wrap( 12 ), Set Title( "" ), font( "Segoe UI", 12, "Plain" ), Legend Position(
					{11, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1], 13, [-1], 12, [-1], 14, [-1] 
					}
				), Orientation( "Vertical" )}
			)
		)
	);
	
	hb &amp;lt;&amp;lt; Append( Report( gb ) &amp;lt;&amp;lt; child );
	hb &amp;lt;&amp;lt; append( Page Break Box() );
	
	gb &amp;lt;&amp;lt; close window;
	
	
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 08 Jun 2023 16:27:13 GMT</pubDate>
    <dc:creator>Matt_1</dc:creator>
    <dc:date>2023-06-08T16:27:13Z</dc:date>
    <item>
      <title>Get 3rd Y axis only for certain columns (working with loops)</title>
      <link>https://community.jmp.com/t5/Discussions/Get-3rd-Y-axis-only-for-certain-columns-working-with-loops/m-p/614215#M81423</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got stuck on a problem and would be grateful for some advice:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We analyze samples and get population A, B, C, D and E for each sample.&lt;/P&gt;&lt;P&gt;The information for A can be divided into "%" and "count" , same for B,C,D and E.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We import the data and the columns named "A 1" to "E 1" represent the "%" values, the ones called "A 2" to "E 2" represent the "Count" values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since the import will always be the same, writing a script to generate graphs with 2 Y axis ("%" and "count") for each population type (A, B, C etc.) was manageable. See the code below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The Problem:&lt;/STRONG&gt; Sometimes we get an additional read out for some of our populations. E.g. only population B and E will have a third information called "fluorescence". These will be imported as columns "B 3" and "E 3" into the same table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since these populations may vary from import to import, I need to write a script which is able to identify "B 3" as a member of the "B"s and creates a 3rd Y axis in the population "B" graph (and the same for "E 3" in this example). But for this I am not smart/experienced enough.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of course, I tried to rearrange the table, create new rows instead of new columns and work with "wrap". But there we have no autoscale for each Y axis. Also tried an associate array for the three information types but failed due to the lack of coding experience.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe one of you has an idea, that could be helpful, thanks&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 );

dt = Current Data Table();
dt &amp;lt;&amp;lt; clear select; 

win = New Window( "Test", Outline Box( "", hb = V List Box() ) );

loopstart = Contains(dt &amp;lt;&amp;lt; get column names, Column("A 1"));
loopend = (Contains(dt &amp;lt;&amp;lt; get column names, Column("A 2")))-1;
icounts = (loopend+1)-loopstart; 

For( i = loopstart, i &amp;lt;= loopend, i++,
		
	
	gb = Graph Builder(
		Size( 1500, 900 ),
		Show Control Panel( 0 ),
		Grid Color( "Black" ),
		Graph Spacing( 2 ),
	
		Legend Position( "Bottom" ), 
	
		Variables( X( :Group ), Y( Eval( i ) ), Y( Eval( i + icounts ) ), Color( :Subjects ) ), 
		Elements( Position( 1, 1 ), Points( X, Y, Legend( 11 ) ), Box Plot( X, Y, Legend( 13 ) ) ), 
		Elements( Position( 1, 2 ), Points( X, Y, Legend( 12 ) ), Box Plot( X, Y, Legend( 14 ) ) ), 
		
	SendToReport(
			Dispatch( {}, "Graph Builder", OutlineBox, {Set Title( "DATA" ), Image Export Display( Normal )} ),
			Dispatch( {}, "graph title", TextEditBox, {Set Text( "Title" )}, {Set Font Size( 16 )} ),
			Dispatch( {}, "Y title", TextEditBox, {Set Font Size( 14 ), Set Font Style( "bold" ), Set Text( " [%]" )} ),
			Dispatch( {}, "Y1 title", TextEditBox, {Set Font Size( 14 ), Set Font Style( "bold" ), Set Text( " Count" )} ), 
			Dispatch( {}, "X title", TextEditBox, {Set Font Size( 14 ), Set Font Style( "bold" )} ), 
			
		
			Dispatch(
				{},
				"400",
				LegendBox,
				{Set wrap( 12 ), Set Title( "" ), font( "Segoe UI", 12, "Plain" ), Legend Position(
					{11, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1], 13, [-1], 12, [-1], 14, [-1] 
					}
				), Orientation( "Vertical" )}
			)
		)
	);
	
	hb &amp;lt;&amp;lt; Append( Report( gb ) &amp;lt;&amp;lt; child );
	hb &amp;lt;&amp;lt; append( Page Break Box() );
	
	gb &amp;lt;&amp;lt; close window;
	
	
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Jun 2023 16:27:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-3rd-Y-axis-only-for-certain-columns-working-with-loops/m-p/614215#M81423</guid>
      <dc:creator>Matt_1</dc:creator>
      <dc:date>2023-06-08T16:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: Get 3rd Y axis only for certain columns (working with loops)</title>
      <link>https://community.jmp.com/t5/Discussions/Get-3rd-Y-axis-only-for-certain-columns-working-with-loops/m-p/614249#M81428</link>
      <description>&lt;P&gt;Here is some pretty ugly code, but it seems to provide to you what you need&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1679326412547.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/51263i69A6B6C74225D249/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1679326412547.png" alt="txnelson_0-1679326412547.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

dt = Current Data Table();
dt &amp;lt;&amp;lt; clear select; 

win = New Window( "Test", Outline Box( "", hb = V List Box() ) );

loopstart = Contains( dt &amp;lt;&amp;lt; get column names, Column( "A 1" ) );
loopend = (Contains( dt &amp;lt;&amp;lt; get column names, Column( "A 2" ) )) - 1;
fluorB3 = Contains( dt &amp;lt;&amp;lt; get column names, Column( "B 3" ) );
fluorE3 = Contains( dt &amp;lt;&amp;lt; get column names, Column( "E 3" ) );
icounts = (loopend + 1) - loopstart; 

For( i = loopstart, i &amp;lt;= loopend, i++, 
		
	If( (Column( i ) &amp;lt;&amp;lt; get name == "B 1" &amp;amp; fluorB3 &amp;gt; 0) | (Column( i ) &amp;lt;&amp;lt; get name == "E 1" &amp;amp; fluorE3 &amp;gt; 0),
		If( Column( i ) &amp;lt;&amp;lt; get name == "B 1",
			fluorcounts = fluorB3,
			fluorcounts = fluorE3
		);
		gb = Graph Builder(
			Size( 1517, 788 ),
			Show Control Panel( 0 ),
			Legend Position( "Bottom" ),
			Grid Color( "Black" ),
			Graph Spacing( 2 ),
			Variables( X( :Group ), Y( Eval( i ) ), Y( Eval( i + icounts ) ), Y( Eval( fluorcounts ) ), Color( :Subjects ) ),
			Elements( Position( 1, 1 ), Points( X, Y, Legend( 11 ) ), Box Plot( X, Y, Legend( 13 ) ) ),
			Elements( Position( 1, 2 ), Points( X, Y, Legend( 12 ) ), Box Plot( X, Y, Legend( 14 ) ) ),
			Elements( Position( 1, 3 ), Points( X, Y, Legend( 15 ) ), Box Plot( X, Y, Legend( 16 ) ) ),
			SendToReport(
				Dispatch( {}, "Graph Builder", OutlineBox, {Set Title( "DATA" ), Image Export Display( Normal )} ),
				Dispatch( {}, "400", ScaleBox, {Legend Model( 12, Base( 0, 0, 0, Item ID( "Car", 1 ) ) )} ),
				Dispatch( {}, "graph title", TextEditBox, {Set Text( "Title" )} ),
				Dispatch( {}, "X title", TextEditBox, {Set Font Size( 14 ), Set Font Style( "Bold" )} ),
				Dispatch( {}, "Y title", TextEditBox, {Set Text( " [%]" ), Set Font Size( 14 ), Set Font Style( "Bold" )} ),
				Dispatch( {}, "Y 1 title", TextEditBox, {Set Text( " Count" ), Set Font Size( 14 ), Set Font Style( "Bold" )} ),
				Dispatch( {}, "Y 2 title", TextEditBox, {Set Text( " Fluor" ), Set Font Size( 14 ), Set Font Style( "Bold" )} ),
				Dispatch(
					{},
					"400",
					LegendBox,
					{font( "Segoe UI", 12, "Plain" ), Orientation( "Vertical" ), Set Wrap( 12 ),
					Legend Position(
						{11, [0, 1, 2, 3], 13, [-1, -1, -1, -1, -1, -3], 12, [-1, -3, -3, -3], 14, [-1, -1, -1, -1, -1, -3], 15, [-1, -1,
						-1, -1, -1, -3], 16, [-1, -1, -1, -1, -1, -3]}
					)}
				)
			)
		);
	, 

		gb = Graph Builder(
			Size( 1500, 900 ),
			Show Control Panel( 0 ),
			Grid Color( "Black" ),
			Graph Spacing( 2 ), 
	
			Legend Position( "Bottom" ), 
	
			Variables( X( :Group ), Y( Eval( i ) ), Y( Eval( i + icounts ) ), Color( :Subjects ) ),
			Elements( Position( 1, 1 ), Points( X, Y, Legend( 11 ) ), Box Plot( X, Y, Legend( 13 ) ) ),
			Elements( Position( 1, 2 ), Points( X, Y, Legend( 12 ) ), Box Plot( X, Y, Legend( 14 ) ) ), 
		
			SendToReport(
				Dispatch( {}, "Graph Builder", OutlineBox, {Set Title( "DATA" ), Image Export Display( Normal )} ),
				Dispatch( {}, "graph title", TextEditBox, {Set Text( "Title" )}, {Set Font Size( 16 )} ),
				Dispatch( {}, "Y title", TextEditBox, {Set Font Size( 14 ), Set Font Style( "bold" ), Set Text( " [%]" )} ),
				Dispatch( {}, "Y1 title", TextEditBox, {Set Font Size( 14 ), Set Font Style( "bold" ), Set Text( " Count" )} ),
				Dispatch( {}, "X title", TextEditBox, {Set Font Size( 14 ), Set Font Style( "bold" )} ), 
			
		
				Dispatch(
					{},
					"400",
					LegendBox,
					{Set wrap( 12 ), Set Title( "" ), font( "Segoe UI", 12, "Plain" ), Legend Position(
						{11, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1], 13, [-1], 12, [-1], 14, [-1]}
					), Orientation( "Vertical" )}
				)
			)
		)
	);
	hb &amp;lt;&amp;lt; Append( Report( gb ) &amp;lt;&amp;lt; child );
	hb &amp;lt;&amp;lt; append( Page Break Box() );
	
	gb &amp;lt;&amp;lt; close window;
	
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Mar 2023 15:34:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-3rd-Y-axis-only-for-certain-columns-working-with-loops/m-p/614249#M81428</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-03-20T15:34:57Z</dc:date>
    </item>
  </channel>
</rss>

