Bar graphs and pie charts for categorical data
Representing Categorical Data
When analyzing categorical data, which classifies individuals into categories or groups, we primarily use two types of graphical displays: bar graphs and pie charts. These tools help us visualize the distribution of a single categorical variable, showing the frequency or relative frequency of each category.
Bar Graphs
A bar graph displays the distribution of a categorical variable by showing the counts (frequencies) or percents (relative frequencies) of observations in each category. Each category is represented by a bar, and the height of the bar indicates the frequency or relative frequency for that category. Key characteristics of a well-constructed bar graph include:
- Categorical Axis: The categories are typically displayed on the horizontal axis.
- Quantitative Axis: The frequency or relative frequency is displayed on the vertical axis. This axis should always start at zero to avoid misleading visual impressions.
- Separated Bars: The bars in a bar graph should be separated by spaces. This visual separation emphasizes that the categories are distinct and not continuous, unlike a histogram where bars touch to represent continuous data intervals.
- Labels and Title: Both axes should be clearly labeled, and the graph should have a descriptive title explaining what is being displayed.
For example, if we surveyed students about their favorite sport (Basketball, Soccer, Tennis), a bar graph would have three distinct bars, each labeled with a sport, and the height of each bar would correspond to the number of students who chose that sport.
Pie Charts
A pie chart (or circle graph) shows the distribution of a categorical variable as a "pie" divided into slices. Each slice represents a category, and the size of the slice (its central angle and area) is proportional to the relative frequency of that category. Pie charts are effective for showing parts of a whole.
- "Whole" Representation: The entire circle represents 100% of the observations.
- Proportional Slices: The angle of each slice is calculated by multiplying the relative frequency (proportion) of the category by 360 degrees. For example, a category representing 25% of the data would have a slice with a 90-degree angle (0.25 * 360°).
- Category Labels: Each slice should be labeled with its category and usually its percentage or count.
Pie charts are most effective when displaying a variable with a small number of categories. They are not suitable for displaying data where the total percentages do not sum to 100% (due to multiple responses or non-mutually exclusive categories). It's also often difficult to accurately compare the sizes of slices that are very similar, where a bar graph might provide a clearer comparison.
Choosing Between Bar Graphs and Pie Charts
While both display categorical data, the choice depends on the specific insight you wish to emphasize:
- Use bar graphs when you want to compare the frequencies or relative frequencies across different categories, especially if the categories are numerous or if you want to make precise comparisons of counts. They are also superior for displaying categorical data where categories do not sum to a logical whole, such as when individuals can belong to multiple categories.
- Use pie charts when you want to show the proportion of each category relative to the whole, assuming all categories sum to 100% and there are not too many categories. They visually emphasize the "part-to-whole" relationship.
Practice questions
What is the primary difference in how bars are displayed between a bar graph and a histogram?
When is a pie chart generally preferred over a bar graph for displaying categorical data?
What common mistake should be avoided when constructing the vertical axis of a bar graph?
A survey found that 30% of respondents preferred 'Comedy', 45% 'Drama', and 25% 'Action'. How would the 'Drama' slice be represented in a pie chart in terms of its central angle?
Related topics
Free AP4U account — unlimited practice, AI grader, and progress tracking.
Canonical: https://apforu.com/ap/statistics/unit-1-exploring-one-variable-data/bar-graphs-and-pie-charts-for-categorical-data