# What is the correct way to plot histogram?

When we plot the frequency histogram, the frequency is equal to the area of the bar or the height of the bar? Is $\text{height} = \frac{\text{frequency}}{\text{size of the class}}$ ? If so, then how to label the vertical axis?

For example, based on the following data,

Class   Frequency
[0,9)      10
[10,19)    20
[20,39)    40


Then what is the label for vertical axis? Is it "frequency" or "frequency density"? The height of first class is 10 or 1.0? For the 3rd class, is it 20, 2.0, or 40?

Based on the information I studied from several links, when the width of the class is different, one needs to use "Frequency density" for the vertical axis. Then, $\text{frequency} = \text{height} \times \text{width of the class}$

If the class are in the same width, then one can use "Frequency" for the vertical axis, then all the heights of the bars are point to the value directly.

-
I don't think there is much I can tell you that is not already well-explained in :en.wikipedia.org/wiki/Histogram. The idea is that there is some proportionality between the height at the value $x_0$ in the horizontal axis, and the total frequency, then, if the frequency of $x_1$ is twice that of $x_0$ the height of the bar along $x_1$ should be twice that of $x_0$ , e.g., if you plot the frequency of rainy days/week in a given year, so that x=0,1,..,7 , and y=0,..,365, and the value $x=2$ is 70 and $x=3$ is 140, then the bar above $x=3$ should be twice-as-high as that above $x=2$. –  gary Sep 7 '11 at 4:33
But you can use either frequency or relative frequency, as you said, as long as you respect the proportionality principle. If you use net frequency, the units on the y-axis would be just the units used for the variable y, e.g., days of rain, lbs (e.g., if doing a histogram for the weights of a collection of students ). If you are doing a relative frequency histogram, then you just use % . –  gary Sep 7 '11 at 4:38

Do it in such a way that the area of each box is proportional to the number of data points, or to the probability (depending on what kind of histogram it is).

The units on the vertical axis should be the reciprocal of the units on the horizontal axis, since when you multiply them to get probability, it needs to be dimensionless. For example, if $x$ is in inches, $y$ is in units per inch or percent per inch.

-

The vertical bar can be used to describe either the net frequency or the relative frequency, as you said. In your example, the vertical bar would describe the frequency, and you can then label the y-axis as frequency; otherwise, you can label it relative frequency.

EDIT: Re the issue of of the height: As long as the bases of the rectangles have equal width (which I initially assumed in my answer)the height you use does not really matter , as long as there is a proportionality between the frequencies and the heights of the bar. if you choose a height of 10 for the interval [0,9) , then you should use a height of 20 for the interval [10,19)(2 times 10, since frequency of values in [10,19) is twice that of the values in [0,9)), and a height of 40 for the third interval [20,39). Similarly, you can choose a height of 1.0 for the value along [0,9), but then the height above [10,19) should be 2.0, and the height above [20,39) should be 4.0 . This last is an incomplete version of the Area Principle. A complete version of the Area Principle allows for the rectangles (i.e., the partition along the horizontal axis) to have different width. All that really matters then is that the proportion between the areas be the same as the proportion between the frequencies or between the relative frequencies.

-
But based on the source like wikipedia, it mentions that the frequency is equal to the area of the bar. Meaning that, for the class [20,39), it should be 2.0 or 20, since the class is twice wider than the first two classes. But the problem is, the vertical axis now should be label as "frequency" or "frequency density"? –  Allen Sep 7 '11 at 7:16
The proportionality should not be between frequencies and heights, but between frequencies and areas. Areas are not proportional to heights unless all of the bases of the rectangles are of equal lengths. –  Michael Hardy Sep 7 '11 at 14:08
@Michael, Allen:you are right; I was assuming the bases of the rectangles had equal length; I had always worked under that (implicit) assumption –  gary Sep 7 '11 at 17:18
@Allen: you can label the vertical axis as frequency or as relative frequency. –  gary Sep 7 '11 at 17:40
Gary, thanks. But the relative frequency is only make the total into 1.00. It seems like nothing related to the width of the class size. –  Allen Sep 8 '11 at 2:24