Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Histogram normalization

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40023] Re: [mg40005] Histogram normalization
  • From: Dr Bob <drbob at bigfoot.com>
  • Date: Sun, 16 Mar 2003 02:22:06 -0500 (EST)
  • References: <200303140947.EAA18857@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

Load packages:

<< Statistics`DescriptiveStatistics`
<< Statistics`NormalDistribution`
<< Graphics`Graphics`

Generate sample data:

{1, 3, 45, 6, 4};
#@% & /@ {Mean, StandardDeviation};
data = Join[%%, Round@RandomArray[NormalDistribution @@ %, {30}]];

The Histogram:

plot = Histogram@data;

The normalized plot:

Show[plot /. {Rectangle[{a_, 0}, {c_, d_}] -> Rectangle[{a, 0}, {c, 
d/Length@data}],
   Line[{{a_, 0}, {a_, b_}, {c_, b_}, {c_, 0}, {a_, 0}}] -> Line[{{a, 0}, 
{a, b/Length@
      data}, {c, b/Length@data}, {c, 0}, {a, 0}}]}]

If you want to isolate the bins and bin-counts, here's a start:

Cases[plot, Rectangle[{a_, _}, {b_, c_}] -> {{a, b}, c}, Infinity]

or you might start this way instead:

Split@Sort@data
{First@#, Length@#} & /@ %

Bobby

On Fri, 14 Mar 2003 04:47:33 -0500 (EST), Jdensmor <densmore.3 at nd.edu> 
wrote:

> Hi all,
> 	I have a list of number {1,3,45,6,4,....etc}, I can make a histogram
> of the data, but now I would like to normalize the histogram so that
> the area under the histogram is equal to 1. Is there a way to get the
> number of bins used in making the histogram and the number of
> particles in each bin? Also is there a way to make a function that has
> the shape of the histogram? thanks for your help
>
> JMD
>
>



-- 
majort at cox-internet.com
Bobby R. Treat



  • Prev by Date: Re: Histogram normalization
  • Next by Date: Re: How to apply one plot range to another plot?
  • Previous by thread: Histogram normalization
  • Next by thread: Re: Histogram normalization