<?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: How can I automatically adjust bin width in distributions based on the data range itself? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-can-I-automatically-adjust-bin-width-in-distributions-based/m-p/433139#M68282</link>
    <description>&lt;P&gt;You could try to script it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Students.jmp");

colList = {"height", "weight"};

dist = dt &amp;lt;&amp;lt; Distribution(
	Continuous Distribution(Column(:height)),
	Continuous Distribution(Column(:weight))
);

wait(2);

rep_layer = Report(dist);
axisbox = rep_layer[axis box(1)];

For Each({val}, colList,
	//some calculation for inc
	newInc = Col Max(Column(dt, val)) - Col Min(Column(dt, val));
	newInc = newInc/10;
	cur_rep = rep_layer[OutlineBox(val)];
	axisbox = cur_rep[axis box(1)];
	axisbox &amp;lt;&amp;lt; Inc(newInc);
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;There is also Bin Span() but I'm not sure if it can be modified after the distribution has been built.&lt;/P&gt;</description>
    <pubDate>Thu, 04 Nov 2021 17:06:04 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2021-11-04T17:06:04Z</dc:date>
    <item>
      <title>How can I automatically adjust bin width in distributions based on the data range itself?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-automatically-adjust-bin-width-in-distributions-based/m-p/433061#M68269</link>
      <description>&lt;P&gt;When I use the distribution platform, by default the bin width are always big and do not help gaining a good understanding of the distribution. The data I have to process vary in orders of maginutes (mega, mili, unit, etc) therefore a fixed bin with for all histograms do not work. Also in the real case that I need to process I have hundreds of tests so it is also not feasible to adjust the plots one by one. Is there a way to make the bin width for each individual plot be determined by the data range? For example I would like to simply grab the range and divide it in 100 equal parts or 50, etc. so regardless of the unit the appearance would be somewhat uniform across all plots without having to individually adjust them. Attached are 3 examples of plots where I wish the default would be to see bin width be set as perhaps 1/100 of the data range.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 11:18:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-automatically-adjust-bin-width-in-distributions-based/m-p/433061#M68269</guid>
      <dc:creator>breino</dc:creator>
      <dc:date>2023-06-11T11:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: How can I automatically adjust bin width in distributions based on the data range itself?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-automatically-adjust-bin-width-in-distributions-based/m-p/433098#M68271</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/33689"&gt;@breino&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;start here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.jmp.com/t5/JMP-Add-Ins/2D-Histograms/ta-p/377945" target="_blank"&gt;https://community.jmp.com/t5/JMP-Add-Ins/2D-Histograms/ta-p/377945&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;let us know if it helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Nov 2021 15:40:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-automatically-adjust-bin-width-in-distributions-based/m-p/433098#M68271</guid>
      <dc:creator>ron_horne</dc:creator>
      <dc:date>2021-11-04T15:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: How can I automatically adjust bin width in distributions based on the data range itself?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-automatically-adjust-bin-width-in-distributions-based/m-p/433106#M68273</link>
      <description>&lt;P&gt;Hello Ron:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the suggestion. Unfortunately it does not like a large number of tests, I tried adding ~ 30 tests to be plotted and gives an error of "Cannot add item: list already contains maximum number of items."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was hoping there was a general setting to adjust the bin width since most distributions come out with wide bars so that must be a global setting somewhere on how to determine how wide they are.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Nov 2021 16:19:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-automatically-adjust-bin-width-in-distributions-based/m-p/433106#M68273</guid>
      <dc:creator>breino</dc:creator>
      <dc:date>2021-11-04T16:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: How can I automatically adjust bin width in distributions based on the data range itself?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-automatically-adjust-bin-width-in-distributions-based/m-p/433139#M68282</link>
      <description>&lt;P&gt;You could try to script it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Students.jmp");

colList = {"height", "weight"};

dist = dt &amp;lt;&amp;lt; Distribution(
	Continuous Distribution(Column(:height)),
	Continuous Distribution(Column(:weight))
);

wait(2);

rep_layer = Report(dist);
axisbox = rep_layer[axis box(1)];

For Each({val}, colList,
	//some calculation for inc
	newInc = Col Max(Column(dt, val)) - Col Min(Column(dt, val));
	newInc = newInc/10;
	cur_rep = rep_layer[OutlineBox(val)];
	axisbox = cur_rep[axis box(1)];
	axisbox &amp;lt;&amp;lt; Inc(newInc);
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;There is also Bin Span() but I'm not sure if it can be modified after the distribution has been built.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Nov 2021 17:06:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-automatically-adjust-bin-width-in-distributions-based/m-p/433139#M68282</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-11-04T17:06:04Z</dc:date>
    </item>
    <item>
      <title>Re: How can I automatically adjust bin width in distributions based on the data range itself?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-automatically-adjust-bin-width-in-distributions-based/m-p/433142#M68283</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/33689"&gt;@breino&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;how about this as a basis for development:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;
Open( "$SAMPLE_DATA/Big Class.jmp" );

Distribution(
	Continuous Distribution( Column( :height ), Set Bin Width( (colmax(:height)-colmin(:height))/50 ) ),
	Continuous Distribution( Column( :weight ), Set Bin Width( (colmax(:weight)-colmin(:weight))/100 ) )
	 );
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Nov 2021 17:08:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-automatically-adjust-bin-width-in-distributions-based/m-p/433142#M68283</guid>
      <dc:creator>ron_horne</dc:creator>
      <dc:date>2021-11-04T17:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: How can I automatically adjust bin width in distributions based on the data range itself?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-automatically-adjust-bin-width-in-distributions-based/m-p/433157#M68287</link>
      <description>&lt;P&gt;Most likely an improvement to my previous code with the Set Bin Width() from &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/958"&gt;@ron_horne&lt;/a&gt; .&lt;/P&gt;&lt;P&gt;Looping can be most likely made in more clever way:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Students.jmp");

colList = {"height", "weight"};

dist = dt &amp;lt;&amp;lt; Distribution(
	Continuous Distribution(Column(:height)),
	Continuous Distribution(Column(:weight))
);

wait(1);

For(i = 1, i &amp;lt;= N Items(colList), i++,
	newInc = Col Max(Column(dt, colList[i])) - Col Min(Column(dt, colList[i]));
	newInc = newInc/10;
	dist[i] &amp;lt;&amp;lt; Set Bin Width(newInc);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Nov 2021 17:16:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-automatically-adjust-bin-width-in-distributions-based/m-p/433157#M68287</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-11-04T17:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: How can I automatically adjust bin width in distributions based on the data range itself?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-automatically-adjust-bin-width-in-distributions-based/m-p/433369#M68306</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/958"&gt;@ron_horne&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;for the code snippets. I will give them a try.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Nov 2021 22:38:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-automatically-adjust-bin-width-in-distributions-based/m-p/433369#M68306</guid>
      <dc:creator>breino</dc:creator>
      <dc:date>2021-11-04T22:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: How can I automatically adjust bin width in distributions based on the data range itself?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-automatically-adjust-bin-width-in-distributions-based/m-p/443180#M69135</link>
      <description>&lt;P&gt;I was able to set the&amp;nbsp; bin with using a portion of the code provided above and using Eval/Parse expressions.&lt;/P&gt;&lt;P&gt;Thanks.&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 = currentdatatable();

col = dt &amp;lt;&amp;lt; get column names();
nc = N Items( col );
colList = {};
bin_width={};

For( i = 1, i &amp;lt;= nc, i++,
	If(Contains (col[i],"::"),
	Insert Into( colList, col[i] ))
);

For(i = 1, i &amp;lt;= N Items(colList), i++,
	Insert Into(bin_width,0.0);
	bin_width[i] = Col Max(Column(dt, colList[i])) - Col Min(Column(dt, colList[i]));
	bin_width[i] = bin_width[i]/10;
);



theExpr = "dis = dt &amp;lt;&amp;lt; Distribution(Stack( 1 ),
	Continuous Distribution( column( column(dt,colList[1])), Set Bin Width(bin_width[1]), Label Row( Label Orientation( \!"Perpendicular\!" ) ))
	";


For( i = 2, i &amp;lt; N Items( colList ), i++,
	theExpr = theExpr || ", Continuous Distribution( column( column(dt, colList[" || Char( i ) || "])), Set Bin Width(bin_width[i]))"
);


theExpr = theExpr || ");";

Eval( Parse( theExpr ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Dec 2021 01:38:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-automatically-adjust-bin-width-in-distributions-based/m-p/443180#M69135</guid>
      <dc:creator>breino</dc:creator>
      <dc:date>2021-12-08T01:38:24Z</dc:date>
    </item>
  </channel>
</rss>

