<?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 Highlight bins in a distribution based on a column value to highlight bin migration in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/804568#M98224</link>
    <description>&lt;P&gt;I have a set of distributions which contain a population of units. I have used a &lt;EM&gt;select where&lt;/EM&gt; with a &lt;EM&gt;containsitem&lt;/EM&gt; call to select the list items in my dataset matching specific DUT reference ID numbers. This helps to show which bins contain the measurements for the units of interest. I would like use the date of test for each instance of the selection to highlight the bin containing measurements. For example if the same unit was tested on 6/20/2024 and later tested again on 6/25/2024, then once more in&amp;nbsp;on 6/28/2024.&amp;nbsp; The bin result from 6/20 would be highlighted with one color and the bin result on the 6/25, 6/28 would two other colors. Some other goals are to have these colors to be consistent across the distributions in the report (one color for each date of test), with all unselected units remaining with default color. I would also like to have the highlight be from top to bottom of the plot for the respective bin.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your support is greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//dtmain &amp;lt;&amp;lt; select where(:SN=="12346777" | :SN=="12346982");
dtmain &amp;lt;&amp;lt; select where(ContainsItem(:SN, {"12346777", "12346982"}));

Distribution(
	Stack( 1 ),
	Continuous Distribution(
		Column( :Average ),
		Horizontal Layout( 1 ),
		Vertical( 0 ),
		Set Bin Width( 2 ),
		Process Capability( 0 )
	),
	Continuous Distribution(
		Column( :Min ),
		Horizontal Layout( 1 ),
		Vertical( 0 ),
		Set Bin Width( 2 ),
		Process Capability( 0 )
	),
	Continuous Distribution(
		Column( :Max ),
		Horizontal Layout( 1 ),
		Vertical( 0 ),
		Set Bin Width( 2 ),
		Process Capability( 0 )
	),
	By(
		:TID, :BLOCKNAME, :MEAS_TYPE
	)
);&lt;/CODE&gt;&lt;/PRE&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="bb101_0-1728511271023.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68972i1C730BAE9854333F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bb101_0-1728511271023.png" alt="bb101_0-1728511271023.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mock-up of what I would like to achieve:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bb101_1-1728511298961.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68973i0C06B03938436A57/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bb101_1-1728511298961.png" alt="bb101_1-1728511298961.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Oct 2024 22:13:13 GMT</pubDate>
    <dc:creator>bb101</dc:creator>
    <dc:date>2024-10-09T22:13:13Z</dc:date>
    <item>
      <title>Highlight bins in a distribution based on a column value to highlight bin migration</title>
      <link>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/804568#M98224</link>
      <description>&lt;P&gt;I have a set of distributions which contain a population of units. I have used a &lt;EM&gt;select where&lt;/EM&gt; with a &lt;EM&gt;containsitem&lt;/EM&gt; call to select the list items in my dataset matching specific DUT reference ID numbers. This helps to show which bins contain the measurements for the units of interest. I would like use the date of test for each instance of the selection to highlight the bin containing measurements. For example if the same unit was tested on 6/20/2024 and later tested again on 6/25/2024, then once more in&amp;nbsp;on 6/28/2024.&amp;nbsp; The bin result from 6/20 would be highlighted with one color and the bin result on the 6/25, 6/28 would two other colors. Some other goals are to have these colors to be consistent across the distributions in the report (one color for each date of test), with all unselected units remaining with default color. I would also like to have the highlight be from top to bottom of the plot for the respective bin.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your support is greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//dtmain &amp;lt;&amp;lt; select where(:SN=="12346777" | :SN=="12346982");
dtmain &amp;lt;&amp;lt; select where(ContainsItem(:SN, {"12346777", "12346982"}));

Distribution(
	Stack( 1 ),
	Continuous Distribution(
		Column( :Average ),
		Horizontal Layout( 1 ),
		Vertical( 0 ),
		Set Bin Width( 2 ),
		Process Capability( 0 )
	),
	Continuous Distribution(
		Column( :Min ),
		Horizontal Layout( 1 ),
		Vertical( 0 ),
		Set Bin Width( 2 ),
		Process Capability( 0 )
	),
	Continuous Distribution(
		Column( :Max ),
		Horizontal Layout( 1 ),
		Vertical( 0 ),
		Set Bin Width( 2 ),
		Process Capability( 0 )
	),
	By(
		:TID, :BLOCKNAME, :MEAS_TYPE
	)
);&lt;/CODE&gt;&lt;/PRE&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="bb101_0-1728511271023.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68972i1C730BAE9854333F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bb101_0-1728511271023.png" alt="bb101_0-1728511271023.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mock-up of what I would like to achieve:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bb101_1-1728511298961.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68973i0C06B03938436A57/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bb101_1-1728511298961.png" alt="bb101_1-1728511298961.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 22:13:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/804568#M98224</guid>
      <dc:creator>bb101</dc:creator>
      <dc:date>2024-10-09T22:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight bins in a distribution based on a column value to highlight bin migration</title>
      <link>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/804616#M98231</link>
      <description>&lt;P&gt;Could you pick a suitable file from the samples folder and create a mockup which illustrates the issue?&lt;BR /&gt;&lt;BR /&gt;The benefits:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;saves time (#1) :&lt;BR /&gt;no user needs to create a mockup dataset&lt;/LI&gt;&lt;LI&gt;saves time (#2):&lt;BR /&gt;helps to understand the issue&lt;/LI&gt;&lt;LI&gt;all replies will be based on a common mockup&lt;BR /&gt;-&amp;gt; easy to compare&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_1-1728542523142.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68977i83C254E010550BAC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_1-1728542523142.png" alt="hogi_1-1728542523142.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;e.g. with temperature data, state selection and colors by quarter -- instead of the original data, DUT selection and colors by&amp;nbsp; measurement dates -- is this what you are interested in?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;div class="lia-vid-container video-embed-center"&gt;&lt;div id="lia-vid-6363106551112w672h246r534" class="lia-video-brightcove-player-container"&gt;&lt;video-js data-video-id="6363106551112" data-account="6058004218001" data-player="default" data-embed="default" class="vjs-fluid" controls="" data-application-id="" style="width: 100%; height: 100%;"&gt;&lt;/video-js&gt;&lt;/div&gt;&lt;script src="https://players.brightcove.net/6058004218001/default_default/index.min.js"&gt;&lt;/script&gt;&lt;script&gt;(function() {  var wrapper = document.getElementById('lia-vid-6363106551112w672h246r534');  var videoEl = wrapper ? wrapper.querySelector('video-js') : null;  if (videoEl) {     if (window.videojs) {       window.videojs(videoEl).ready(function() {         this.on('loadedmetadata', function() {           this.el().querySelectorAll('.vjs-load-progress div[data-start]').forEach(function(bar) {             bar.setAttribute('role', 'presentation');             bar.setAttribute('aria-hidden', 'true');           });         });       });     }  }})();&lt;/script&gt;&lt;a class="video-embed-link" href="https://community.jmp.com/t5/video/gallerypage/video-id/6363106551112"&gt;(view in My Videos)&lt;/a&gt;&lt;/div&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;dt = Open( "$SAMPLE_DATA/Functional Data/Weekly Weather Data.jmp" );

dt &amp;lt;&amp;lt; New Column( "selected Quarter",
	"Ordinal",
	Formula( If( Selected(), Quarter( :DATE ) ) ),
	Set Property(
		"Value Colors",
		{1 = -13912408, 2 = -4042310, 3 = -4354269, 4 = -13400361}
	)
);

dt  &amp;lt;&amp;lt; Graph Builder(
	Transform Column( "temperature", Formula( Round( :TAVG / 2 ) * 2 ) ),
	Size( 568, 328 ),
	Show Control Panel( 0 ),
	Variables( X( :STATION ), X( :temperature ), Overlay( :selected Quarter ) ),
	Elements( Position( 1, 1 ), Bar( X, Overlay( 0 ), Legend( 9 ), Bar Style( "Stacked" ) ) ),
	Elements( Position( 2, 1 ), Bar( X, Legend( 1 ), Bar Style( "Stacked" ) ) ),
	SendToReport(
			Dispatch( {}, "400", ScaleBox,
			{Legend Model( 1, Properties( 0, {Fill Color( 32 )}, Item ID( "Missing", 1 ) ) )}
		),
		Dispatch( {}, "Graph Builder", FrameBox( 2 ), {Fill Selection Mode( "Unselected Faded" )} )
	)
);&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2024 05:23:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/804616#M98231</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-10-11T05:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight bins in a distribution based on a column value to highlight bin migration</title>
      <link>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/804618#M98232</link>
      <description>&lt;P&gt;You can do this maybe with reference lines&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

dt = Open("$SAMPLE_DATA/Big Class.jmp");

dist = dt &amp;lt;&amp;lt; Distribution(
	Stack(1),
	Continuous Distribution(
		Column(:height),
		Horizontal Layout(1),
		Vertical(0),
		Set Bin Width(2),
		Process Capability(0)
	)
);
ab = Report(dist)[AxisBox(1)];

ab &amp;lt;&amp;lt; Add Ref Line({60, 62}, "Solid", "Red", "", 1, 0.25);
ab &amp;lt;&amp;lt; Add Ref Line({62, 64}, "Solid", "Green", "", 1, 0.25);
ab &amp;lt;&amp;lt; Add Ref Line({64, 66}, "Solid", "Blue", "", 1, 0.25);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1728545727586.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68978i02DFB32115E62EE5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1728545727586.png" alt="jthi_0-1728545727586.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or using graphic scripts&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1); 

dt = Open("$SAMPLE_DATA/Big Class.jmp");

dist = dt &amp;lt;&amp;lt; Distribution(
	Stack(1),
	Continuous Distribution(
		Column(:height),
		Horizontal Layout(1),
		Vertical(0),
		Set Bin Width(2),
		Process Capability(0)
	)
);

fb = Report(dist)[FrameBox(2)];
fb &amp;lt;&amp;lt; Add Graphics Script(
	1,
	Transparency(0.2);
	Fill Color("Red");
	Rect(68, Y Range() + 10, 70, Y Origin(), 1);

	Transparency(0.2);
	Fill Color("Light Green");
	Rect(70, Y Range() + 10, 72, Y Origin(), 1);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1728545742413.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68979i72998351412637E2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1728545742413.png" alt="jthi_1-1728545742413.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;To get same coloring across all distributions, you could set value colors property for your dates and utilize that when setting the colors, or create a list of colors and use those in order.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 07:35:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/804618#M98232</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-10-10T07:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight bins in a distribution based on a column value to highlight bin migration</title>
      <link>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/804659#M98239</link>
      <description>&lt;P&gt;Here is my take on how to do this.&amp;nbsp; It finds the selected rows and the bins associated with them, and then adds the reference lines as required.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1728557598362.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68983i2ADD7F164591726C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1728557598362.png" alt="txnelson_0-1728557598362.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 ); 

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

// For illustration, randomly select some rows
For( i = 1, i &amp;lt;= 3, i++,
	dt &amp;lt;&amp;lt; select rows( Random Integer( 1, N Rows( dt ) ) )
);

dist = dt &amp;lt;&amp;lt; Distribution(
	Stack( 1 ),
	Continuous Distribution(
		Column( :height ),
		Quantiles( 0 ),
		Summary Statistics( 0 ),
		Horizontal Layout( 1 ),
		Vertical( 0 ),
		Set Bin Width( 2 ),
		Process Capability( 0 )
	)
);
distRPT = Report( dist )[AxisBox( 1 )];
// Find the Midpoints of the bins the selected rows are in
dist &amp;lt;&amp;lt; Save( "Level Midpoints" );
theBins = (Associative Array( Column( dt, N Cols( dt ) )[dt &amp;lt;&amp;lt; get selected rows] )) &amp;lt;&amp;lt; get keys;
dt &amp;lt;&amp;lt; delete columns( N Cols( dt ) );

// Get the Increment of the X axis
theIncr = distRPT[AxisBox( 1 )] &amp;lt;&amp;lt; get inc;

// Add the reference lines for each selected bin

For Each( {bin, index}, theBins,
	binList = {};
	Insert Into( binList, bin - theIncr / 2 );
	Insert Into( binList, bin + theIncr / 2 );
	Eval( Eval Expr( distRPT &amp;lt;&amp;lt; Add Ref Line( Expr( binList ), "Solid", Expr( Index + 2 ), "", 1, 0.25 ) ) );
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;An expansion on this to where interactively the graph would change as the user selects and deselects different rows, would require adding in a RowState Handler, and some logic that would first remove any existing reference lines, and then add the new ones.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 10:56:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/804659#M98239</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-10-10T10:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight bins in a distribution based on a column value to highlight bin migration</title>
      <link>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/804660#M98240</link>
      <description>&lt;P&gt;A question to be answered:&amp;nbsp;&lt;BR /&gt;how should the colors be assigned and how should the range be marked.&lt;BR /&gt;e.g. if&amp;nbsp;&lt;SPAN&gt;6/20 data for the selected IDs&amp;nbsp; is: 48, 90 ( 77, 56, ...).&lt;BR /&gt;&lt;BR /&gt;Or the reverse: can we be sure that the data for all the selected Device IDs at one date are in the same bin&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2024 09:59:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/804660#M98240</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-10-11T09:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight bins in a distribution based on a column value to highlight bin migration</title>
      <link>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/804933#M98277</link>
      <description>&lt;P&gt;Noted. Thank you. I will adapt my question to use available data as you suggested.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 20:31:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/804933#M98277</guid>
      <dc:creator>bb101</dc:creator>
      <dc:date>2024-10-10T20:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight bins in a distribution based on a column value to highlight bin migration</title>
      <link>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/804940#M98279</link>
      <description>&lt;P&gt;Thank you for the support.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to use the add Ref as you and &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;suggested. I used the approach for coloration and confirmed it will work for a single distribution. When I add By conditions, I lose the plot addressing capability resulting in errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As suggested by&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/26800"&gt;@hogi&lt;/a&gt;&amp;nbsp;I switched to available data for this question. To help facilitate the question I augmented Big Class in a modified version of Jim's script. Here are the steps I followed and the outcomes&lt;/P&gt;&lt;P&gt;1. Import Big Class&lt;/P&gt;&lt;P&gt;2. Conditionally add some data if the column "State" is not in the table&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; a. Add a column named State with sequenced data to place people in either "CA", "WA" or "OR".&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; b. Add a second "PATTY"&amp;nbsp; who is 16, "F", 57, 134 and is in "WA".&lt;/P&gt;&lt;P&gt;3. Select some names. I chose LESLIE and PATTY&lt;/P&gt;&lt;P&gt;4. Run script to find and highlight bins of interest.&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT color="#008000"&gt;OK&lt;/FONT&gt; Case - remove&amp;nbsp;&lt;CODE class=" language-jsl"&gt;By (:State)&lt;/CODE&gt;&amp;nbsp;from the script below and change the preceding comma to a semicolon to run successfully. The code finds both instances of Patty and uses different colors for each of them. If they had the same height, for this example the reference lines would overlap only showing one of the two colors.&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/26800"&gt;@hogi&lt;/a&gt;&amp;nbsp;made a good point about the arbitration of which color is shown. Once I understand the element addressing, I plan to add a conditional for the case where more than one interesting data point occurs in the same bin.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-90px"&gt;&amp;nbsp; &amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bb101_0-1728593270576.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/69022i06100CA148BC3B37/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bb101_0-1728593270576.png" alt="bb101_0-1728593270576.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT color="#FF0000"&gt;NG&lt;/FONT&gt; Case - run distribution with a By condition based on :State and see an error in addressing the plot object. I tried&amp;nbsp; a few addressing permutations without success. I am missing key information to access the AxisBox.&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;Did not work either:&lt;/P&gt;&lt;P class="lia-indent-padding-left-90px"&gt;distRPT = Report( dist )["height",AxisBox( 1 )];&lt;/P&gt;&lt;P class="lia-indent-padding-left-90px"&gt;distRPT = Report( dist )["State=WA","height",AxisBox( 1 )];&lt;/P&gt;&lt;P class="lia-indent-padding-left-90px"&gt;distRPT = Report( dist["State=WA"] )["height",AxisBox( 1 )];&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&lt;STRONG&gt;Sample error code: object not subscriptable at row 41 in access or evaluation of 'Report(dist)[ /*###*/AxisBox(1)]' , Report( dist )[/*###*/AxisBox( 1 )]&lt;/STRONG&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&amp;nbsp;&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 ); 

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );


col_name_list = dt &amp;lt;&amp;lt; get column names(string);
newColName = "State";

// New column: State
if (!contains(col_name_list, newColName),
	Local( {dt, tempStrings},
		dt = Data Table( "Big Class" );
		dt &amp;lt;&amp;lt; New Column( "State", Character, "Nominal" ) &amp;lt;&amp;lt; Begin Data Update;
		tempStrings = {"CA", "WA", "OR"};
		For Each Row( dt, :State = tempStrings[Sequence( 1, 3, 1, 1 )] );
		dt &amp;lt;&amp;lt; End Data Update;
	);
	//Make it a double Patty :), another person with the same name.
	dt &amp;lt;&amp;lt; Add Rows( 1, At End );
	//Cheat and use a constant of 41 for the last row index
	dt[[41],{name,age,sex,height,weight,State}] = {{"PATTY", 16, "F", 57, 134, "WA"}};
);


// For illustration, select some names
dt &amp;lt;&amp;lt; select where( ContainsItem(:name, {"LESLIE","PATTY"}));

dist = dt &amp;lt;&amp;lt; Distribution(
	Stack( 1 ),
	Continuous Distribution(
		Column( :height ),
		Quantiles( 0 ),
		Summary Statistics( 0 ),
		Horizontal Layout( 1 ),
		Vertical( 0 ),
		Set Bin Width( 2 ),
		Process Capability( 0 )
	),
	By (:State)
);
distRPT = Report( dist )[AxisBox( 1 )];
// Find the Midpoints of the bins the selected rows are in
dist &amp;lt;&amp;lt; Save( "Level Midpoints" );
theBins = (Associative Array( Column( dt, N Cols( dt ) )[dt &amp;lt;&amp;lt; get selected rows] )) &amp;lt;&amp;lt; get keys;
dt &amp;lt;&amp;lt; delete columns( N Cols( dt ) );

// Get the Increment of the X axis
theIncr = distRPT[AxisBox( 1 )] &amp;lt;&amp;lt; get inc;

// Add the reference lines for each selected bin

For Each( {bin, index}, theBins,
	binList = {};
	Insert Into( binList, bin - theIncr / 2 );
	Insert Into( binList, bin + theIncr / 2 );
	Eval( Eval Expr( distRPT &amp;lt;&amp;lt; Add Ref Line( Expr( binList ), "Solid", Expr( Index + 2 ), "", 1, 0.25 ) ) );
);

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your comments and guidance are appreciated.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Bryan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 21:00:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/804940#M98279</guid>
      <dc:creator>bb101</dc:creator>
      <dc:date>2024-10-10T21:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight bins in a distribution based on a column value to highlight bin migration</title>
      <link>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/805003#M98285</link>
      <description>&lt;P&gt;nice : )&lt;BR /&gt;&lt;BR /&gt;concerning "find the right axis box", this wish in the Wish List:&lt;BR /&gt;&lt;LI-MESSAGE title="Make it easier to get results from reports via JSL" uid="433969" url="https://community.jmp.com/t5/JMP-Wish-List/Make-it-easier-to-get-results-from-reports-via-JSL/m-p/433969#U433969" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-idea-thread lia-fa-icon lia-fa-idea lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;BR /&gt;has the status "in the queue" - I hope, besides "easier to get results from reports", it will also facilitate the way to find the right axis box ...&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2024 05:18:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/805003#M98285</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-10-11T05:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight bins in a distribution based on a column value to highlight bin migration</title>
      <link>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/805005#M98286</link>
      <description>&lt;P&gt;My first guess is that you are trying to use Report() function on a list (check what dist contains using Show(dist);) when you are using By&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2024 06:10:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/805005#M98286</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-10-11T06:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight bins in a distribution based on a column value to highlight bin migration</title>
      <link>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/805007#M98288</link>
      <description>&lt;P&gt;If you need the BY groups, it gets a bit more complicated.&lt;BR /&gt;Every subplot can have different bin widths. This is why a for loop is necessary:&lt;/P&gt;&lt;P&gt;- to get the individual bin widths.&lt;BR /&gt;- to get the selected rows for the specific subplot&lt;BR /&gt;- to add the &lt;FONT face="courier new,courier"&gt;ref lines&lt;/FONT&gt; to the specific subplot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hm, maybe rethinking the idea of the shaded regions - we also have the issue with the colors.&lt;BR /&gt;At the moment, we just apply a different color to every &lt;U&gt;selected&lt;/U&gt; bin. The shaded regions look nice - but the width is quite arbitrary. Maybe just add a line per selected ID?&amp;nbsp;How many "IDs" do you want to select?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;When it smells like tape, it's time to ask: are we reinventing the wheel?&lt;BR /&gt;In general Graph Builder can do such things automatically without the need to talk to the report layer ...&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 ); 

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );


col_name_list = dt &amp;lt;&amp;lt; get column names( string );
newColName = "State";

// New column: State
If( !Contains( col_name_list, newColName ),
	Local( {dt, tempStrings},
		dt = Data Table( "Big Class" );
		dt &amp;lt;&amp;lt; New Column( "State", Character, "Nominal" ) &amp;lt;&amp;lt; Begin Data Update;
		tempStrings = {"CA", "WA", "OR"};
		For Each Row( dt, :State = tempStrings[Sequence( 1, 3, 1, 1 )] );
		dt &amp;lt;&amp;lt; End Data Update;
	);
	//Make it a double Patty :), another person with the same name.
	dt &amp;lt;&amp;lt; Add Rows( 1, At End );
	//Cheat and use a constant of 41 for the last row index
	dt[[41], {name, age, sex, height, weight, State}] = {{"PATTY", 16, "F", 57, 134, "WA"}};
);


// For illustration, select some names
dt &amp;lt;&amp;lt; select where( Contains Item( :name, {"LESLIE", "PATTY"} ) );

dist = dt &amp;lt;&amp;lt; Distribution(
	Stack( 1 ),
	Continuous Distribution(
		Column( :height ),
		Quantiles( 0 ),
		Summary Statistics( 0 ),
		Horizontal Layout( 1 ),
		Normal Quantile Plot( 0 ), // disable, if the user enabled it in the preferences :)
		Vertical( 0 ),
		Set Bin Width( 2 ),
		Process Capability( 0 )
	),
	By( :State )
);


// get all reports
// if there is a BY group, get the info - if there is none, put it into a list
 If( Is List( dist ),
	dists=dist;
	myBys = Transform each ({myexpr} , dist &amp;lt;&amp;lt; Get Where Expr, Arg(myExpr , 2 ))
	
	, //no By
	
	dists = Eval List( {dist} );
	myBys= {};
	
);

//get the reports
distRPTs = Transform Each( {dist}, dists, Report( dist ) );


// Find the Midpoints of the bins the selected rows are in
dist &amp;lt;&amp;lt; Save( "Level Midpoints" );

//loop though the By groups and add the reflines
For Each( {report, idx}, distRPTs,
//report = distRPTs[2]; idx=2;
	selected rows = dt &amp;lt;&amp;lt; get selected rows;

	// there is a BY group -&amp;gt; restrict the selection
	if(N Items(myBys),
	Eval( Eval Expr( selected rows = dt &amp;lt;&amp;lt; get rows where( Contains( Expr( selected rows ), Row() ) &amp;amp; :State == Expr( myBys[idx] ) ) ) );
	);


	theBins = (Associative Array( Column( dt, N Cols( dt ) )[selected rows] )) &amp;lt;&amp;lt; get keys;
	
	// Get the Increment of the X axis
	theIncr = report[AxisBox( 1 )] &amp;lt;&amp;lt; get inc;

// Add the reference lines for each selected bin

	For Each( {bin, index}, theBins,
	//bin = 57; index=1
		binList = {};
		Insert Into( binList, bin - theIncr / 2 );
		Insert Into( binList, bin + theIncr / 2 );
		Eval( Eval Expr(report[AxisBox( 1 )] &amp;lt;&amp;lt; Add Ref Line( Expr( binList ), "Solid", Expr( Index + 2 ), "", 1, 0.25 ) ) );
	);

);
dt &amp;lt;&amp;lt; delete columns( N Cols( dt ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Oct 2024 09:40:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/805007#M98288</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-10-11T09:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight bins in a distribution based on a column value to highlight bin migration</title>
      <link>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/805063#M98302</link>
      <description>&lt;P&gt;via Graph Builder:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;div class="lia-vid-container video-embed-center"&gt;&lt;div id="lia-vid-6363115770112w884h340r589" class="lia-video-brightcove-player-container"&gt;&lt;video-js data-video-id="6363115770112" data-account="6058004218001" data-player="default" data-embed="default" class="vjs-fluid" controls="" data-application-id="" style="width: 100%; height: 100%;"&gt;&lt;/video-js&gt;&lt;/div&gt;&lt;script src="https://players.brightcove.net/6058004218001/default_default/index.min.js"&gt;&lt;/script&gt;&lt;script&gt;(function() {  var wrapper = document.getElementById('lia-vid-6363115770112w884h340r589');  var videoEl = wrapper ? wrapper.querySelector('video-js') : null;  if (videoEl) {     if (window.videojs) {       window.videojs(videoEl).ready(function() {         this.on('loadedmetadata', function() {           this.el().querySelectorAll('.vjs-load-progress div[data-start]').forEach(function(bar) {             bar.setAttribute('role', 'presentation');             bar.setAttribute('aria-hidden', 'true');           });         });       });     }  }})();&lt;/script&gt;&lt;a class="video-embed-link" href="https://community.jmp.com/t5/video/gallerypage/video-id/6363115770112"&gt;(view in My Videos)&lt;/a&gt;&lt;/div&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Column( "selected",
	Character,
	Formula( If( Col Maximum( Selected( Row State() ), :name ), :name, "-" ) )
)

New Window( "try",
	H List Box(
		Graph Builder( Size( 519, 452 ), Show Control Panel( 0 ), Show Legend( 0 ), Variables( X( :name ) ), Elements( Bar( X ) ) );


		gb = Graph Builder(
			Size( 487, 500 ),
			Show Control Panel( 0 ),
			Variables( X( :height ), Wrap( :State ), Color( :selected ) ),
			Elements(
				Heatmap( X, Legend( 8 ) ),
				Histogram( X, Legend( 6 ), Response Scale( "Fill" ) ),
				Points( X, Legend( 9 ), Jitter( "None" ) )
			),
			SendToReport(
				Dispatch( {}, "400", ScaleBox,
					{Legend Model( 8, Properties( 0, {Transparency( 0 )}, Item ID( "-", 1 ) ) ), Legend Model(
						9,
						Properties( 0, {Transparency( 0 )}, Item ID( "-", 1 ) )
					)}
				)
			)
		);
	)
);

(gb &amp;lt;&amp;lt; xpath( "//FrameBox" )) &amp;lt;&amp;lt; {Marker Drawing Mode( "Outlined" ), Marker Size( 10 ), Transparency( 0.5 ),
Fill Selection Mode( "Unselected Faded" )};&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2024 10:13:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/805063#M98302</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-10-11T10:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight bins in a distribution based on a column value to highlight bin migration</title>
      <link>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/805423#M98366</link>
      <description>&lt;P&gt;Thanks for your replies. I was able to adapt the code to address the Indvidual plots. In my analysis I have three subplots for each set of conditions. I resorted to hardcoding the subplot index.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Is List( rptDist ),
	dists=rptDist;
	myBys1 = Transform each ({myexpr} , rptDist &amp;lt;&amp;lt; Get Where Expr, Arg(myExpr , 1 ));
	myBys2 = Transform each ({myexpr} , rptDist &amp;lt;&amp;lt; Get Where Expr, Arg(myExpr , 2 ));
	myBys3 = Transform each ({myexpr} , rptDist &amp;lt;&amp;lt; Get Where Expr, Arg(myExpr , 3 ));
	, //else condition - no By conditions in Distribution call
	dists = Eval List( {rptDist} );
	myBys= {};
	
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;On to a new challenge. in that the use of Associative Array calls is losing information. Will create a separate post for the next challenge since the plotting goal here has been achieved.&amp;nbsp;&lt;BR /&gt;Thanks everyone!&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 19:17:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/805423#M98366</guid>
      <dc:creator>bb101</dc:creator>
      <dc:date>2024-10-14T19:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: Highlight bins in a distribution based on a column value to highlight bin migration</title>
      <link>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/805453#M98369</link>
      <description>&lt;P&gt;Hi Jarmo,&lt;/P&gt;&lt;P&gt;I've added the nested for loops which achieved the desired result. Without the second loop the added reference would only appear in the first of the three plots. Please note that I assigned&amp;nbsp;&lt;CODE class=" language-jsl"&gt;numOfPlots&lt;/CODE&gt;&amp;nbsp;a constant value of 3.&amp;nbsp; I was looking for a way to interrogate the report(AxisBox... for dimensions, but I did not find the right object to return the correct count.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;In all there are three nested for loops to produce distributions and to annotate them with refence lines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;...
For Each( {report, idx}, distRPTs,  //grab each report in the 
...
	For Each( {bin, index}, theBins, //process bin for each report
...
		For( iPlot = 1, iPlot &amp;lt;= numOfPlots, iPlot +=1,  &amp;lt;&amp;lt; add refer. in each of the subplots.
...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&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;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;...&lt;BR /&gt;For Each( {bin, index}, theBins,
		binList = {};
		//TBD change bin width to avoid offset when bin width is an odd number
		Insert Into( binList, bin - theIncr / 2 );
		Insert Into( binList, bin + theIncr / 2 );
		For( iPlot = 1, iPlot &amp;lt;= numOfPlots, iPlot +=1,  
			
			Eval( Eval Expr(report[AxisBox( iPlot )] &amp;lt;&amp;lt; Add Ref Line( Expr( binList ), "Solid", Expr( Index + 2 ), "", 1, 0.25 ) ) );
		);
	);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 20:15:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Highlight-bins-in-a-distribution-based-on-a-column-value-to/m-p/805453#M98369</guid>
      <dc:creator>bb101</dc:creator>
      <dc:date>2024-10-14T20:15:33Z</dc:date>
    </item>
  </channel>
</rss>

