Bar Charts & Histograms

How to make bar charts and histograms
Bar charts and histograms are two types of charts that help us visualize data.

Bar Charts

A bar chart uses rectangular bars to compare the values of different categories. The x-axis (the horizontal axis) shows the categories and the y-axis (the vertical axis) shows the values of those categories.

For example, suppose we have this dataset:


To make a bar chart, we place the cities on the x-axis and the population of those cities on the y-axis:


This bar chart helps us visualize the difference in city populations more easily than if we simply stared at the numeric list of populations.

Histograms

A histogram also uses bars to represent data, but unlike bar charts, histograms have a quantitative variable (a numeric variable) along the x-axis.

For example, suppose we have this dataset:


To make a histogram, we place the exam scores on the x-axis and the count of students who received those scores on the y-axis:


This histogram shows us that seven students scored between an 88 and 98, six scored between a 78 and 88, five scored between a 68 and 78, and two scored between a 58 and 68.

Notice how the the numbers along the x-axis are ranges with a width of 10. When we make histograms, we can make the ranges as narrow or as wide as we want. For example, here is the same histogram where the x-axis groups have a width of five:

The Difference Between Bar Charts & Histograms

  • Bar charts use categorical variables along the x-axis and histograms use quantitative (“numeric”) variables along the x-axis.
  • Bar charts typically have gaps between the bars, but histograms do not.

Leave a Reply

Your email address will not be published. Required fields are marked *