2.3 Histograms: a graphical visualisation of frequency tables

A histogram is a very popular visualisation tool to summarise the distribution of continuous or discrete data. In a histogram, the variable is divided into intervals called ‘bins’. You then count the number of observations in each bin. The horizontal x-axis displays the ‘bins’ and vertical y-axis displays the number of observations in each bin. Histograms can help you to see whether the data is clustered around certain values or whether there are many small or many large values. A typical histogram in Excel looks like the following bar chart. In a correct histogram, there are no spaces or gaps between the bars.

A histogram in Excel
Figure 17 A typical histogram in Excel

In the following activity, you will learn how to plot a histogram in Excel.

Activity 6: Using Excel to draw a histogram

Allow approximately 60 minutes to complete this activity

In this activity, you will learn how to produce a histogram in Excel by following the instructions that are given below. Once you have produced the histogram in Excel, you can check your answer by clicking ‘Reveal discussion’ below.

  • Open the Excel file called JC Electrics template, sheet Histogram which contains the quarterly data of number of generators sold. Column A contains information about the number of generators sold per quarter.
  • Use the same data and table format as calculated in the Group frequency table.
  • There are many ways to calculate the width of the bin in Excel. One of the easiest ways to calculate this is similar as the width of the bin or class intervals. As previously indicated, this would be the range divided by square root of sample size, which was 1.63.
  • Click on ‘Data Analysis’ in the ‘Data’ ribbon. This will bring up a list of some of the statistical analyses that you can perform in Excel.
  • Select ‘Histogram’ and click ‘OK’.
  • Specify the input range as A5:A28 and the bin range as D5:D9. Excel automatically allocates a $ sign for each selection as in Figure 18.
  • Tick the box ‘Chart Output’ and specify the output location as H12, as shown below.
Excel spreadsheet for JC Electrics
Figure 18 A frequency distribution table in Excel

Click ‘OK’. Excel will put the histogram next to your frequency table.

Histogram dialog box in Excel
Figure 19 Histogram dialog box in Excel

Click ‘OK’. Excel will put the histogram next to your frequency table.

Excel spreadsheet showing a table and histogram for JC Electrics
Figure 20 Histogram of number of units sold (Generators)
  • To remove the space between the bars, right click a bar, click Format Data Series, and change the Gap Width to 0%.
  • To add borders, right click a bar, click Format Data Series, click the Fill & Line icon, click Border, and select a colour.
  • Now click ‘Reveal discussion’ to compare what you have made against the answer.

Discussion

A histogram in Excel
Figure 21 Histogram showing units sold of generators

Working through the steps given above should return the completed histogram shown in Figure 20.