Histogram

Download as PDF

Histograms are one of the most powerful tools in statistics for visualizing numerical data. Unlike a simple bar chart, a histogram reveals the underlying shape and distribution of your dataset, allowing you to easily spot patterns, clusters, skewness, and outliers. Mastering them is a key step in data analysis.

Histogram — an original Algebra911 reference diagram defining histogram with its key formula and a worked example.
Histograms Explained: A Visual Guide to Data Distribution

What Is a Histogram?

A histogram is a graphical representation that organizes a group of numerical data points into a series of specified ranges, called bins. In essence, it's a type of bar chart that shows the frequency distribution of continuous data. The height of each bar represents the number of data points (frequency) that fall within that particular range or bin. A key visual feature of a histogram is that the bars are drawn adjacent to each other, without any gaps, to signify that the data is continuous along the x-axis.

While they look similar, histograms and bar charts serve different purposes and display different types of data. A histogram is used exclusively for numerical data that can be measured on a continuous scale (like height, weight, or time), while a bar chart is used for categorical data (like favorite colors, types of pets, or months of the year).

Here is a table summarizing the key differences:

FeatureHistogramBar Chart
Data TypeQuantitative (Numerical, Continuous)Categorical (Qualitative, Discrete)
X-AxisA continuous number line divided into bins or intervals.Discrete, separate categories or labels.
BarsBars touch each other to show the continuous nature of the data.Bars are separated by gaps to show that categories are distinct.
PurposeTo show the shape and distribution of a dataset.To compare the values or frequencies of different categories.

How Do You Create a Histogram Step-by-Step?

Building a histogram from a set of raw data is a systematic process. By following these steps, you can transform a list of numbers into a powerful visual tool. Let's use a sample dataset of final exam scores for a class of 25 students:

[82,93,75,68,88,78,89,99,56,72,80,85,91,76,65,84,79,90,70,81,92,77,83,88,74]

  1. Step 1: Find the Range of the Data.
    The range is the difference between the highest and lowest values in your dataset. This tells you the overall spread of your data.
    • Maximum value (Max): 99
    • Minimum value (Min): 56
    • Range = Max - Min = 9956=43
  2. Step 2: Determine the Number of Bins.
    The number of bins (or bars) you choose is critical because it can affect how the distribution appears. A common guideline is to use the square root of the number of data points. For our 25 scores, 25=5. So, 5 bins is a great starting point. For most datasets, using between 5 and 15 bins works well.
  3. Step 3: Calculate the Bin Width.
    The bin width determines the range of each bar on the x-axis. To find it, divide the range by the number of bins you chose. It's often best to round this number up to a convenient value (like a whole number or a multiple of 5 or 10).
    Bin Width = RangeNumber of Bins

    For our data: Bin Width = 435=8.6. Let's round this up to a cleaner number like 10 to make our bins easy to read.

  4. Step 4: Create the Bins and a Frequency Table.
    Now, create the intervals for your bins using the width you just calculated. Start from a number at or slightly below your minimum value. Our minimum is 56, so starting at 50 is a good choice. Then, tally how many data points fall into each bin. It's crucial to be consistent about bin boundaries. A common convention is that the interval includes the lower value but excludes the upper value. For example, the bin [70,80) includes 70 but not 80.

Frequency Table for Exam Scores

  • Bin 1: [50, 60) — Scores from 50 up to (but not including) 60. Tally: 1 (56)
  • Bin 2: [60, 70) — Scores from 60 up to 70. Tally: 2 (68,65)
  • Bin 3: [70, 80) — Scores from 70 up to 80. Tally: 8 (75,78,72,76,79,70,77,74)
  • Bin 4: [80, 90) — Scores from 80 up to 90. Tally: 9 (82,88,89,80,85,84,81,83,88)
  • Bin 5: [90, 100) — Scores from 90 up to 100. Tally: 5 (93,99,91,90,92)
  1. Step 5: Draw the Histogram.
    Finally, draw your graph.
    • The x-axis represents the data values (in our case, Exam Scores). Mark the boundaries of your bins: 50,60,70,80,90,100.
    • The y-axis represents the frequency (the count of scores in each bin). Label it from 0 up to at least your highest frequency, which is 9.
    • Draw a bar for each bin, with the height corresponding to its frequency from your table. Remember, the bars must touch each other.

By following these steps, you've successfully turned a list of numbers into a meaningful visual that shows most students scored in the 70s and 80s.

Worked Example: Creating a Histogram from Scratch

Example 1

Let's create a histogram for the heights (in inches) of 20 members of a high school basketball team. The data is as follows:

[72,75,78,81,76,77,80,74,79,83,82,77,75,79,80,78,76,81,74,78]

Step 1: Find the Range.
The maximum height is 83 inches and the minimum is 72 inches.
Range = 8372=11 inches.

Step 2: Determine the Number of Bins.
We have 20 data points. Let's use the square root rule as a guide: 204.47. We can choose to use either 4 or 5 bins. Let's use 4 bins for this example.

Step 3: Calculate the Bin Width.
Bin Width = RangeNumber of Bins=114=2.75.
To make the bins easier to work with, we'll round this up to a whole number, 3.

Step 4: Create the Bins and Frequency Table.
We'll start at our minimum value, 72. Using a width of 3, our bins will be [72,75), [75,78), and so on. Let's tally the frequencies for each bin.

Bin (Height in inches)TallyFrequency
[72, 75)72, 74, 743
[75, 78)75, 76, 77, 75, 77, 766
[78, 81)78, 80, 79, 79, 80, 78, 787
[81, 84)81, 83, 82, 814

Check: The sum of frequencies is 3+6+7+4=20, which matches our total number of data points.

Step 5: Draw the Histogram.

  • Draw and label the x-axis for 'Height (inches)' with marks at 72,75,78,81,84.
  • Draw and label the y-axis for 'Frequency' or 'Number of Players' with marks up to at least 7.
  • For the bin [72,75), draw a bar up to a height of 3.
  • For the bin [75,78), draw a bar right next to the first one up to a height of 6.
  • For the bin [78,81), draw a bar up to a height of 7.
  • For the bin [81,84), draw a bar up to a height of 4.

The resulting histogram would show that the most common height range for this team is between 78 and 81 inches.

How Do You Interpret the Shape of a Histogram?

A histogram's true power lies in its ability to tell a story about your data. The shape of the distribution can reveal key characteristics at a glance. Here are the most common shapes you'll encounter:

  • Symmetrical (or Bell-Shaped): This shape, often called a normal distribution, looks like a bell. The peak is in the middle, and the data tapers off evenly on both sides. This indicates that most data points cluster around the average, with fewer points at the extremes. Example: The distribution of IQ scores in a large population.
  • Skewed Right (Positively Skewed): In a right-skewed distribution, the peak is on the left side, and a long 'tail' of data extends to the right. This means most of the data has lower values, but there are a few unusually high values (outliers) pulling the tail to the right. Example: The salaries of employees at a company, where most people earn a moderate salary but a few executives earn very high salaries.
  • Skewed Left (Negatively Skewed): This is the opposite of skewed right. The peak is on the right, and a long tail extends to the left. This indicates that most of the data has higher values, with a few unusually low values. Example: The scores on a very easy test, where most students get high scores but a few students score very low.
  • Bimodal: A bimodal distribution has two distinct peaks. This often suggests that your dataset contains two different groups. Example: The heights of a mixed group of 9th and 12th graders would likely show two peaks, one for each grade's average height.
  • Uniform: A uniform distribution is mostly flat, with bars of roughly the same height. This means that the data is spread out evenly across the range, with no clear peaks or clusters. Example: The results of rolling a fair six-sided die many times would produce a nearly uniform distribution for the numbers 1 through 6.

By identifying the shape, you can quickly understand the central tendency, spread, and symmetry of your data without looking at a single number.

Why Is Choosing the Right Number of Bins So Important?

The number of bins you select can dramatically alter the story your histogram tells. It's a balance between seeing the big picture and getting lost in the details. An inappropriate number of bins can hide important features or create misleading patterns.

  • Too Few Bins: If you use too few bins, you risk over-simplifying the data. Important details like multiple peaks or the true nature of the skewness can be hidden inside a few large, blocky bars. The overall shape becomes too coarse to be useful.
  • Too Many Bins: If you use too many bins, you create a 'skyscraper' effect with many tall, skinny bars. This introduces too much noise and makes it difficult to see the underlying distribution shape. You lose the pattern because you are focusing too much on individual data points.

There is no single 'perfect' number of bins, but a good starting point is the Square Root Rule, where the number of bins is approximately the square root of the number of data points (n).

Number of Bins n

However, this is just a guideline. The best approach is often to experiment with a few different bin widths to see which one best illustrates the underlying patterns in your data without being misleading.

Example 2

Let's reconsider the basketball player height data from Example 1 (n=20). Our initial choice of 4 bins gave a clear picture. What if we made different choices?

Case A: Too Few Bins (2 Bins)
With a range of 11, we might choose a bin width of 6. This gives us two bins: [72,78) and [78,84).

  • Frequency for [72,78): 9 players
  • Frequency for [78,84): 11 players
This histogram would just be two large bars. It suggests a slight bimodal tendency, but it hides the fact that the data is more concentrated in the middle of the overall range. We've lost all the detail.

Case B: Too Many Bins (11 Bins)
Let's use a bin width of 1. This gives us bins like [72,73), [73,74), etc.

  • Frequency for [72,73): 1
  • Frequency for [73,74): 0
  • Frequency for [74,75): 2
  • ...and so on.
This histogram would be very spiky and noisy, with many bars having a frequency of 0, 1, or 2. It would be almost impossible to see the central tendency or the overall shape of the distribution. It looks more like a collection of individual points than a cohesive group.

This shows that our original choice of 4 bins was a good compromise, providing a clear and accurate summary of the data's distribution.

Key formulas for histogram by Algebra911.
Key formulas for histogram by Algebra911.

Common Mistakes to Avoid

When first learning about histograms, students often make a few common errors. Being aware of these pitfalls can help you create accurate and meaningful graphs.

  1. Confusing Histograms with Bar Charts. This is the most frequent mistake. Remember, histograms are for continuous numerical data (bars touch), while bar charts are for discrete categorical data (bars have gaps). Don't use a histogram to display data like 'favorite pizza topping'.
  2. Using Unequal Bin Widths. For a standard histogram, all bins must have the same width. Using different widths can distort the visual representation of the data, making some areas appear more or less dense than they actually are. While advanced histograms (with area proportional to frequency) exist, you should always use equal bin widths in algebra.
  3. Incorrectly Labeling Axes. A histogram is meaningless without clear labels. The x-axis must be labeled with the variable being measured (e.g., 'Height in cm') and show the scale of the bins. The y-axis must be labeled 'Frequency' or 'Count'.
  4. Misinterpreting Bar Height. The height of a bar represents the number of data points in that interval, not the value of the data itself. A tall bar at [80,90) doesn't mean the data has a value of 80 or 90; it means many data points fall somewhere within that range.
  5. Choosing a Poor Number of Bins. As discussed in the previous section, selecting too few or too many bins can completely obscure the true nature of your data's distribution. Always take a moment to consider if your choice of bins makes sense.
Example 3

A teacher surveys her class to find their favorite subject and gets the following results: Math (10 students), Science (8 students), English (7 students), and History (5 students).

The Mistake: A student decides to make a histogram. They put 'Math', 'Science', 'English', and 'History' on the x-axis and draw bars of heights 10,8,7, and 5 right next to each other with no gaps.

Why It's Wrong: The data ('favorite subject') is categorical, not numerical. There is no continuous scale along the x-axis. The order of the subjects is arbitrary, and the touching bars wrongly imply a connection between them (as if 'Science' flows directly from 'Math').

The Correction: The correct way to display this data is with a bar chart. Each subject should have its own separate bar, with gaps in between to emphasize that they are distinct categories. This allows for a clear comparison of the popularity of each subject.

Quick Summary and Key Terms

This lesson covered the essentials of creating and interpreting histograms. Here's a quick recap of the most important concepts.

  • A Histogram is a graph that uses bars to show the frequency distribution of continuous numerical data.
  • The bars in a histogram touch to represent the continuous nature of the data on the x-axis.
  • To create a histogram, you must determine the range, choose a number of bins, calculate the bin width, and create a frequency table.
  • The shape of a histogram reveals key information: it can be symmetrical, skewed right, skewed left, bimodal, or uniform.
  • Choosing the right number of bins is crucial for an accurate and useful visualization.

Key Terms Reference:

  • Frequency: The number of times a value or a value within a certain range appears in a dataset.
  • Bin (or Interval): A range of values on the x-axis of a histogram. All data points that fall within this range are counted in the bin's frequency.
  • Range: The difference between the maximum and minimum values in a dataset.
  • Distribution: The way data points are spread out or clustered together. The histogram's shape shows the distribution.
  • Skewness: A measure of the asymmetry of a distribution. A distribution can be skewed to the left (negative) or right (positive) if it has a long tail on one side.

Frequently Asked Questions

What's the main difference between a histogram and a bar chart?

The biggest difference is the type of data they represent. A histogram shows the distribution of continuous numerical data (like height or weight), and its bars touch. A bar chart compares discrete categorical data (like favorite colors or car brands), and its bars have gaps between them.

Why don't the bars on a histogram have gaps?

The bars on a histogram touch to signify that the x-axis represents a continuous range of numbers. A gap would imply a break in the data, but in a histogram, the bins flow from one to the next without interruption. For example, the bin ending at 50 is immediately followed by the bin starting at 50.

What does it mean if a histogram is 'skewed right'?

A right-skewed (or positively skewed) histogram has a peak on the left and a long tail extending to the right. This means that most of the data values are clustered on the lower end, but there are a few unusually high values that pull the average up and stretch the graph to the right.

How do I pick the number of bins for my histogram?

There's no perfect rule, but a good starting place is the square root rule: choose a number of bins close to the square root of your number of data points. The goal is to find a balance. Too few bins will hide details, while too many will create a noisy, unreadable graph.

Can a histogram have a bar with a frequency of zero?

Yes, absolutely. A bar with a frequency of zero simply means that no data points from your set fell within that particular bin or interval. This can be useful information, as it shows a gap in the data distribution.

What is a frequency table and why do I need one?

A frequency table is an organized list of your bins and the count (frequency) of how many data points fall into each bin. It's a crucial intermediate step between your raw data and your final histogram, as it provides the exact heights you will need to draw for each bar.

Can you use a histogram for non-numerical data like colors or names?

No, a histogram is only for numerical data that can be ordered and measured on a continuous scale. For non-numerical (categorical) data like colors, names, or types of animals, you must use a bar chart, where each category gets its own separate bar.

What does a 'bimodal' histogram tell me?

A bimodal histogram has two distinct peaks, which suggests that your data might be coming from two different groups. For example, if you measured the wait times at a coffee shop, you might see one peak for the morning rush and another for the afternoon, indicating two different patterns of customer traffic.