3.1: Graphical Displays for Categorical Data- Bar Charts, Pie Charts
- Page ID
- 58893
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\dsum}{\displaystyle\sum\limits} \)
\( \newcommand{\dint}{\displaystyle\int\limits} \)
\( \newcommand{\dlim}{\displaystyle\lim\limits} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\(\newcommand{\longvect}{\overrightarrow}\)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)Not all data represents numbers we can measure or order. In fact, some of the most common types of information we work with are categories: like restaurant type, customer satisfaction level, favorite color, or type of transportation. These variables are called categorical variables, and they require a different approach when we want to visualize them.
When working with numerical data, we spend time thinking about things like center, spread, or shape. But categorical data doesn't have a numeric “center” or follow a number line. Instead, we focus on frequencies: how many individuals fall into each category.
In this part of the chapter, we’ll introduce two powerful tools that help us see and compare category frequencies:
- Bar Charts: great for comparing categories side-by-side
- Pie Charts: good for showing how the categories make up a whole
Quick Review: What Is Categorical Data?
Categorical variables represent groups, labels, or classifications. They could be things like:
- Political party
- Type of payment (Cash, Credit, Debit)
- Brand preference
- Survey responses (Yes, No, Maybe)
We usually summarize these using counts or relative frequencies (percentages). And that's exactly what a bar chart or pie chart is designed to show.
Bar Charts: Compare Categories Clearly
A bar chart shows the frequency or proportion of each category using vertical or horizontal bars. The height or length of each bar represents the count (or percentage) in each category.
- Best for side-by-side comparisons
- Axes should be clearly labeled
- Include a title and consider sorting bars in chronological or frequency order
When to Use a Bar Chart
- You want to compare categories individually
- You want to see which category is largest or smallest
- You don’t need to focus on showing the “whole” (100%)
Example: Bar Chart — Preferred Study Environment
A college library surveyed 100 students, asking them where they most prefer to study on campus. The results were divided into five categories based on student responses.
Here is the frequency table from the survey:
| Study Environment | Number of Students |
|---|---|
| Library (Quiet Floor) | 32 |
| Café | 18 |
| Study Rooms | 25 |
| Commons | 15 |
| Other | 10 |
Question: What does this distribution tell us about student study habits? Is one area clearly preferred, or are preferences spread evenly?
To visualize these results, we create a bar chart with the study environments on the x-axis and the number of students on the y-axis.
Interpretation
In the bar chart, it’s immediately clear that the Quiet Floor in the Library is the preferred study environment, followed by Group Study Rooms. Only a few students prefer outdoor or alternate spaces. Bar charts like this make it easy to compare across categories and spot dominant choices.
Pie Charts: Highlight Part-to-Whole Relationships
A pie chart shows each category as a slice of a circular “pie.” The angle of each slice represents that category’s share of the total — usually displayed in percentages.
- Shows proportionality
- Works best with few categories
- Slices can be labeled with % or category name for clarity
Warning: Pie Chart Perception
Pie charts use angles to represent relative frequencies, but most people naturally interpret the area of each slice instead.
This can be misleading — especially when slices are similar in size or when visual embellishments exaggerate differences. Be cautious when reading or designing pie charts.
Example: Pie Chart: How Students Commute to Campus
A student organization surveys 142 campus commuters to find out how students usually get to class. The goal is to understand what fraction of students use different transportation modes for possible sustainability planning.
Here is a breakdown from the survey:
| Transportation Mode | Number of Students | Percentage |
|---|---|---|
| Drive Alone | 60 | 42% |
| Public Transit | 45 | 32% |
| Carpool | 8 | 6% |
| Bike | 15 | 11% |
| Walk | 14 | 10% |
Figure: Pie chart of student commuting choices as a percentage of all respondents. Without the percentages labeled, one would not be able to easily compare the 'Bike' and 'Walk categories.
Interpretation
Driving alone is the most common commute method, used by 42% of students, but Public Transit is also heavily used (32%), and 27% of students are using more sustainable or shared modes (carpool, bike, or walk). This pie chart quickly shows how each mode contributes to the whole and helps support campus planning discussions. Note that rounding leads to the percentage total not adding to exactly 100%.
Why A Pie Chart is Admissible Here
- There are only 5 categories, all clearly distinct
- We want to emphasize percentages and part-of-whole relationships
Bar vs. Pie: Which Should You Use?
In general, one should primarily use bar charts. The data on student commute times is shown in a bar chart below. Although the emphasis is no longer on percentage out of the whole, the comparison between individual columns is much more apparent. As long as proper axis labels are used and show the full scale of the bars, the information conveyed in the bar chart will be easier to understand and interpret.
Check-In Prompt
Find a categorical variable in your semester housing dataset (e.g., housing type, city, zip code range).
- How many categories are there?
- Would a bar chart or pie chart give the clearest picture of this variable?
- Create a rough sketch or build a quick chart using Excel or Google Sheets.
Related Videos
What's Next?
In the next section, we’ll explore how to visualize numerical (quantitative) data, including some of the most important foundational plots in statistics: histograms, dot plots, and stemplots.


