Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Collect histogram data in an association of bin intervals and bin heights
| ResourceFunction["BinCountAssociation"][{x1,x2,…}] gives an association of bin intervals and histogram heights of the values xi. | |
| ResourceFunction["BinCountAssociation"][data,bspec] gives an association of bin intervals and histogram heights with bins specified by bspec. | |
| ResourceFunction["BinCountAssociation"][data,bspec,hspec] gives an association of bin intervals and histogram heights with bin heights computed according to the specification hspec. | 
Generate an Association of bin intervals and heights:
| In[1]:= | ![ResourceFunction["BinCountAssociation"][
 RandomVariate[NormalDistribution[], 200]]](https://www.wolframcloud.com/obj/resourcesystem/images/93e/93ebf3eb-c8dc-4f6c-9ccc-5ed634837a30/404f2f8c3a6c0d55.png) | 
| Out[1]= |  | 
Use unit width bins:
| In[2]:= | ![ResourceFunction["BinCountAssociation"][
 RandomVariate[NormalDistribution[], 100], {1}]](https://www.wolframcloud.com/obj/resourcesystem/images/93e/93ebf3eb-c8dc-4f6c-9ccc-5ed634837a30/2e827162f10a2d18.png) | 
| Out[2]= |  | 
Use different height functions:
| In[3]:= | ![data = RandomVariate[NormalDistribution[], 100];](https://www.wolframcloud.com/obj/resourcesystem/images/93e/93ebf3eb-c8dc-4f6c-9ccc-5ed634837a30/598c0c5611a88be9.png) | 
| In[4]:= | ![ResourceFunction["BinCountAssociation"][data, {1}, "Count"]](https://www.wolframcloud.com/obj/resourcesystem/images/93e/93ebf3eb-c8dc-4f6c-9ccc-5ed634837a30/5b9e71851cf609ae.png) | 
| Out[4]= |  | 
| In[5]:= | ![ResourceFunction["BinCountAssociation"][data, {1}, "PDF"]](https://www.wolframcloud.com/obj/resourcesystem/images/93e/93ebf3eb-c8dc-4f6c-9ccc-5ed634837a30/4fdd5f87fdcbb7d9.png) | 
| Out[5]= |  | 
| In[6]:= | ![ResourceFunction["BinCountAssociation"][data, {1}, "CDF"]](https://www.wolframcloud.com/obj/resourcesystem/images/93e/93ebf3eb-c8dc-4f6c-9ccc-5ed634837a30/6777abcb005af240.png) | 
| Out[6]= |  | 
This work is licensed under a Creative Commons Attribution 4.0 International License