WeCodeAcademy

Box Plots

A box plot summarises a distribution in five numbers and lets you compare several groups side by side. The box spans the middle half of the data (the quartiles), the line inside it is the median, the whiskers reach the typical extremes, and dots beyond them are outliers.

ax.boxplot([group1, group2], labels=['A', 'B']) draws one box per list. Box plots hide the exact shape of each group but excel at showing differences in centre, spread and unusual values.

Examplepython
Open in editor »
Quick check

What does the line inside a box show?

Your turn: write the code

Draw a box plot of scores and print its median (use float(bp['medians'][0].get_ydata()[0])).

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.