4
$\begingroup$

When doing Histogram[data], I get the total number of counts in each bin. Doing Histogram[data, Automatic, "Probability"] normalizes the area to unity, so typically the height of the histogram will be $<1$. Similarly, Histogram[data, Automatic, "PDF"] won't have unit height.

So, how to make a histogram have normalized height?

$\endgroup$
  • 1
    $\begingroup$ The answer below directly answers your question but I'm curious as to why you'd want to do this as this is not a good way to compare different histograms. $\endgroup$ – JimB Nov 16 '15 at 16:27
  • $\begingroup$ @JimBaldwin I want to emphasize the shape of a histogram, and the height is irrelevant for this. And having one histogram two or five times lower than another makes it not so clear. $\endgroup$ – corey979 Nov 23 '15 at 14:18
  • 1
    $\begingroup$ Thanks for responding. This might cross over the line and be more appropriate for a "chat" but I'd argue that comparing histograms appropriately is on an "equal area" basis rather than an "equal height" basis. If it is a single histogram then, minimizing the white space with a scale where the tallest bar is at the top of the figure is definitely the way to go. But not for comparing histograms (or smoothed histograms). $\endgroup$ – JimB Nov 23 '15 at 15:44
11
$\begingroup$

You can use your own normalization function

Histogram[RandomReal[NormalDistribution[], 1000], Automatic, #2/Max@#2 &]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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