Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working on creating a line plot from a histogram, as in the following:

{g, {binCounts}} = 
  Reap[Histogram[RandomVariate[NormalDistribution[0, 1], 100], 
         {-2,2,0.25}, 
         Function[{bins, counts}, Sow[counts]]]];

{g, ListLinePlot[binCounts]}

What I'd like to know is, how can I normalised this line so the area under the curve is 1? (So I can compare the shapes of these histograms independent of the number of counts)

share|improve this question
up vote 4 down vote accepted
  1. Use the "Probability" hspec in Histogram (check the docs)

  2. Use HistogramList to get the data (instead of a plot)

    {bins, heights} = HistogramList[rr, Automatic, "Probability"]
    
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.