Box Plot Anatomy
Run the Box Plot Anatomy MicroSim Fullscreen
Edit in the p5.js Editor
About This MicroSim
A box plot summarizes a set of numbers with five values and marks any outliers. This MicroSim draws the box plot of 21 quiz scores and numbers its parts:
- Minimum: the end of the lower whisker, the smallest value that is not an outlier
- Q1: the first quartile, the edge of the box on the low side
- Median: the line inside the box
- Q3: the third quartile, the edge of the box on the high side
- Maximum: the end of the upper whisker, the largest value that is not an outlier
- IQR: the interquartile range, the length of the box, \(Q3 - Q1\)
- Outliers: values beyond the fences at \(Q1 - 1.5 \times IQR\) and \(Q3 + 1.5 \times IQR\)
The gray dots under the box are the 21 scores themselves, so each part can be checked against the data. The panel below the plot gives the meaning of the selected part, the calculation with the numbers of this data, and one line of pandas. Quartiles use linear interpolation, the default of Series.quantile and np.percentile.
The whiskers follow the matplotlib and pandas convention: a whisker ends at the most extreme data value that is still inside the fence, not at the fence itself. Here the lower fence is at 28, but the whisker stops at 41, the smallest score that is not below 28. Selecting the minimum, the maximum, or the outliers draws both fences as dashed lines.
How to Use
- Read the summary panel, then hover over each numbered badge (or its name) to highlight that part and read about it.
- Click a part to keep its explanation on screen. Click it again, or click empty space, to return to the summary.
- Select Minimum, Maximum, or Outlier to see the two fences as dashed lines and compare them with the whisker ends.
- Check Vertical to turn the plot the way
df.boxplot()draws it by default. - Uncheck Show names, name each numbered part from memory, and click the badge to check yourself.
Iframe Embed Code
You can add this MicroSim to any web page by adding this to your HTML:
1 2 3 4 | |
Lesson Plan
Grade Level
High School (11-12) and College Freshman
Duration
5-10 minutes
Prerequisites
Sorting a list of numbers, the median, and the idea of a percentile.
Bloom's Taxonomy Level
Remember (L1)
Learning Objective
Students will be able to identify the seven parts of a box plot and recall what each one represents.
Activities
- Explore (3 min): Students hover over the seven parts in order and write each name and its meaning in a table.
- Check against the data (3 min): Students count the gray dots below Q1, below the median, and below Q3 and compare the counts with 25%, 50%, and 75% of 21.
- Self-test (3 min): With Show names unchecked and the plot vertical, students name each numbered part and click it to check.
Assessment
Given an unlabeled box plot, students label the median, Q1, Q3, both whisker ends, the IQR, and any outliers, and write the two fence formulas.
References
- Wikipedia. Box plot.
- pandas documentation. pandas.DataFrame.boxplot.
- Matplotlib documentation. matplotlib.pyplot.boxplot.