# Normalizing a histogram data [closed]

I made a histogram of 1000 random coin tosses.How can I normalize the numbers in order to get the probabilities for each number. Basically, scaling the Y axis by a factor of 1/1000

The data are in the Table format.

• Maybe this just is a bit of semantics but you get the proportions of the observed two numbers (usually 0 and 1) rather than the probabilities. And if there are just two numbers, why would you want to create a histogram when reporting just two 2 numbers (1,000 and the proportion of observed heads) will tell as much about the results in a lot less space? – JimB Sep 22 '16 at 23:29
• Does Histogram[data,Automatic,"Probability"] do what you want? – Lukas Sep 23 '16 at 6:39

As a summary, here are the different possibilities available to you.

# The Easy Way

As often in Mathematica, the easiest way is usually to use a built-in construct. As @Lukas mentioned in the comments, you can use the special height specification "Probability" in Histogram[] to get what you want.

data=Table[RandomInteger[],{1000}]
Histogram[data,Automatic,"Probability"] # The Alternative

But maybe, as @Jim Baldwin said, an alternative visualisation is best? Sometimes, you can't beat a simple table...

counts = Tally@Table[RandomInteger[], {1000}];
Text /@ {"count", counts[[1, 2]], counts[[2, 2]]},
Text /@ {"probability", N[counts[[1, 2]]/1000],
N[counts[[2, 2]]/1000]}}, Frame -> All] Strictly speaking however, you are asking to normalize the histogram scale. To do this, you need to define a custom height function as defined in the "Details and Options" section of the reference on Histogram.
heightfunction[bins_, counts_] := counts/1000; 