Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

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.