<?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: Add reference line to distribution plot in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Add-reference-line-to-distribution-plot/m-p/538477#M75954</link>
    <description>&lt;P&gt;Here is a rework of your script.&amp;nbsp; The issue you are having is that the Display Tree for Bivariate is different than the Display Tree output from the Variance charts.&amp;nbsp; You need to read the section in the Scripting Guide on Display Trees so you can work with the various forms of the output.&amp;nbsp; Also, the Means from your reference table seem to be wrong.&amp;nbsp; See the output below.&amp;nbsp; The mean for Current 1.1 is listed as 166, and the listed maximum is only 2.49.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

dt1 = Data table( "Reference data table.jmp");
dt2 = Data table("Data table upd");//("Current Data Table();
Col_List = dt2 &amp;lt;&amp;lt; Get Column Group( "Tests");							


vc2 = Eval(
	Eval Expr(
		dt2 &amp;lt;&amp;lt; distribution(
			Stack( 1 ), 
			
			Column( Expr( Col_List ) ),
			Horizontal Layout( 1 ),
			Normal Quantile Plot( 1 ),
			Vertical( 1 ),
			Process Capability( 0 )
			
		)
	)
);

aa_refs = Associative Array( dt1:Tests &amp;lt;&amp;lt; get values, dt1:Mean &amp;lt;&amp;lt; get values );

/*For( i = 1, i &amp;lt;= N Items( Col_List ), i++,
	If( Contains( aa_refs, Col_List[i] ),
		Report( vc2[i] )[Framebox( 1 )] &amp;lt;&amp;lt; DispatchSeg( CustomStreamSeg( 3 ), {Line Width( 2 )} );
		Report( vc2[i] )[AxisBox( 1 )] &amp;lt;&amp;lt; {Add Ref Line( aa_refs[Col_List[i]], "Solid", "Green", "RTS", 2 )};
	)
);*/


For( i = 1, i &amp;lt;= N Items( Col_List ), i++,
	If( Contains( aa_refs, char(Col_List[i]) ),
		Report( vc2 )[char(Col_List[i])][Axisbox( 1 )] &amp;lt;&amp;lt; Add Ref Line( aa_refs[char(Col_List[i])], "Solid", "Green", "RTS", 2 );
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1661796759253.png" style="width: 776px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/45069i53BCDB506257D82E/image-dimensions/776x819?v=v2" width="776" height="819" role="button" title="txnelson_0-1661796759253.png" alt="txnelson_0-1661796759253.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 29 Aug 2022 18:12:54 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2022-08-29T18:12:54Z</dc:date>
    <item>
      <title>Add reference line to distribution plot</title>
      <link>https://community.jmp.com/t5/Discussions/Add-reference-line-to-distribution-plot/m-p/538351#M75948</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to add a reference line in the distribution plots.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reference values are stored in the second file "Reference data table"&lt;/P&gt;&lt;P&gt;Here's my code:&amp;nbsp; It doesn't works on histogram plots but works on Var charts. Any advice would be appreciated&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 );


dt1 = Data table( "Reference data table.jmp");
dt2 = Current Data Table();
Col_List = dt2 &amp;lt;&amp;lt; Get Column Group( "Tests" );
								


vc2 = Eval(
	Eval Expr(
		dt2 &amp;lt;&amp;lt; distribution(
			Stack( 1 ), 
			
			Column( Expr( Col_List ) ),
			Horizontal Layout( 1 ),
			Normal Quantile Plot( 1 ),
			Vertical( 1 ),
			Process Capability( 0 )
			
		)
	)
);

aa_refs = Associative Array( dt1:Tests &amp;lt;&amp;lt; get values, dt1:Mean &amp;lt;&amp;lt; get values );

For( i = 1, i &amp;lt;= N Items( Col_List ), i++,
	If( Contains( aa_refs, Col_List[i] ),
		Report( vc2[i] )[Framebox( 1 )] &amp;lt;&amp;lt; DispatchSeg( CustomStreamSeg( 3 ), {Line Width( 2 )} );
		Report( vc2[i] )[AxisBox( 1 )] &amp;lt;&amp;lt; {Add Ref Line( aa_refs[Col_List[i]], "Solid", "Green", "RTS", 2 )};
	)
);

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:08:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-reference-line-to-distribution-plot/m-p/538351#M75948</guid>
      <dc:creator>Jackie_</dc:creator>
      <dc:date>2023-06-09T17:08:36Z</dc:date>
    </item>
    <item>
      <title>Re: Add reference line to distribution plot</title>
      <link>https://community.jmp.com/t5/Discussions/Add-reference-line-to-distribution-plot/m-p/538473#M75953</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;any suggestions?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2022 17:47:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-reference-line-to-distribution-plot/m-p/538473#M75953</guid>
      <dc:creator>Jackie_</dc:creator>
      <dc:date>2022-08-29T17:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: Add reference line to distribution plot</title>
      <link>https://community.jmp.com/t5/Discussions/Add-reference-line-to-distribution-plot/m-p/538477#M75954</link>
      <description>&lt;P&gt;Here is a rework of your script.&amp;nbsp; The issue you are having is that the Display Tree for Bivariate is different than the Display Tree output from the Variance charts.&amp;nbsp; You need to read the section in the Scripting Guide on Display Trees so you can work with the various forms of the output.&amp;nbsp; Also, the Means from your reference table seem to be wrong.&amp;nbsp; See the output below.&amp;nbsp; The mean for Current 1.1 is listed as 166, and the listed maximum is only 2.49.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

dt1 = Data table( "Reference data table.jmp");
dt2 = Data table("Data table upd");//("Current Data Table();
Col_List = dt2 &amp;lt;&amp;lt; Get Column Group( "Tests");							


vc2 = Eval(
	Eval Expr(
		dt2 &amp;lt;&amp;lt; distribution(
			Stack( 1 ), 
			
			Column( Expr( Col_List ) ),
			Horizontal Layout( 1 ),
			Normal Quantile Plot( 1 ),
			Vertical( 1 ),
			Process Capability( 0 )
			
		)
	)
);

aa_refs = Associative Array( dt1:Tests &amp;lt;&amp;lt; get values, dt1:Mean &amp;lt;&amp;lt; get values );

/*For( i = 1, i &amp;lt;= N Items( Col_List ), i++,
	If( Contains( aa_refs, Col_List[i] ),
		Report( vc2[i] )[Framebox( 1 )] &amp;lt;&amp;lt; DispatchSeg( CustomStreamSeg( 3 ), {Line Width( 2 )} );
		Report( vc2[i] )[AxisBox( 1 )] &amp;lt;&amp;lt; {Add Ref Line( aa_refs[Col_List[i]], "Solid", "Green", "RTS", 2 )};
	)
);*/


For( i = 1, i &amp;lt;= N Items( Col_List ), i++,
	If( Contains( aa_refs, char(Col_List[i]) ),
		Report( vc2 )[char(Col_List[i])][Axisbox( 1 )] &amp;lt;&amp;lt; Add Ref Line( aa_refs[char(Col_List[i])], "Solid", "Green", "RTS", 2 );
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1661796759253.png" style="width: 776px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/45069i53BCDB506257D82E/image-dimensions/776x819?v=v2" width="776" height="819" role="button" title="txnelson_0-1661796759253.png" alt="txnelson_0-1661796759253.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2022 18:12:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-reference-line-to-distribution-plot/m-p/538477#M75954</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-08-29T18:12:54Z</dc:date>
    </item>
  </channel>
</rss>

