In a previous post about Frequency Distribution tables, a lot of pre-work was done to setup a set of frequency distribution and relative frequency distribution into tabular form.
This time, I’ll take the same data set used, and plot a histogram to visually notice the frequency distribution.
import matplotlib.pyplot as plt my_range = np.array([1,4,9,22,24,26,28,33,35,43,44,48,51,52,55,59,68,69,79,80,81,83,85, 93,97,100]) bins=[1,20,40,60,80,100] plt.hist(my_range, bins=bins) plt.show()
Unlike tabular data, the histogram gives us a visual representation of data. Although I’ve omitted the axis labels, the x axis is age intervals and the y would be the value counts.
Again the group 40-60 has the highest amount of values (7.)
Difference Between Bar Chart
It might be tempting to think of a histogram as a bar chart. There is at least one major difference. A bar chart shows distinct bars (separated by space) to indicate the specific groups of values. An example might be car manufacturers (Audi, BMW, Dodge, etc.)
A histogram has each “bar” touching the other, which indicates a continuous dataset. These are not distinct categories but rather a continuous flow of values (in this case, ranging from 1 to 100.)