# Boxplots

Learn how to create and interpret boxplots using a variety of different datasets

Start## Key Concepts

Review core concepts you need to learn to master this subject

Box Plot Values

Usage of Side-by-side Box plots

Side-by-side Boxplots

Box Plot Outliers

Box Plot Whiskers

Boxplot in Matplotlib

Box Plot Values

Box Plot Values

The box in the box plot displays the dataset’s median, first and third quartile, and the interquartile range. The line in the center of the box shows the median, the edges shows the first and third quartiles, and the interquartile range is visualized by the width of the box.

Usage of Side-by-side Box plots

Usage of Side-by-side Box plots

The two datasets can be analyzed visually by placing two box plots side by side. This allows easy comparison of median, first and third quartiles and the IQR of the datasets.

Side-by-side Boxplots

Side-by-side Boxplots

In Python’s Matplotlib library, if multiple datasets are specified in function `pyplot.boxplot()`

, then those datasets will be visualized as side by side box plots.

Box Plot Outliers

Box Plot Outliers

In a box plot, the data points that fall beyond the whiskers are called outliers. They are usually labeled with a dot or an asterisk.

Box Plot Whiskers

Box Plot Whiskers

A box plot’s whiskers are the lines that extends from the 1st or 3rd quartile to points farthest from the median. The upper whisker of the box plot is the largest dataset number smaller than 1.5*IQR above the third quartile and the lower whisker is the smallest dataset number larger than 1.5*IQR below the first quartile.

Boxplot in Matplotlib

Boxplot in Matplotlib

In Python’s Matplotlib library, the `pyplot.boxplot()`

function takes a dataset as input and returns a box plot.

- 1Boxplots are one of the most common ways to visualize a dataset. Like histograms , boxplots give you a sense of the central tendency and spread of the data. Take a look at the boxplot on this pag…
- 2When making a box plot, the easiest place to start is the line that is inside the box. This line is the median of the dataset. Half of the data falls above that line and half falls below it. We …
- 3Now that we’ve drawn the median, let’s draw the edges of the box. The box extends to the first and third quartile of the dataset. This visually splits the data into fourths. One-quarter of the d…
- 4The whiskers of a boxplot display information related to the spead of the dataset. There are many different ways to plot the whiskers of a boxplot. You might see some boxplots where the whiskers …
- 5The final piece of a boxplot is the representation of outliers. An outlier is a point in the dataset that falls outside of the whiskers. Outliers are usually represented with a dot or an asterisk.
- 6We’ve spent this lesson building a boxplot by hand. Let’s now look at how Python’s Matplotlib library does it! The matplotlib.pyplot module has a function named boxplot(). boxplot() takes a datase…
- 7Great work! Here are some of the major takeaways from boxplots:
*The box of a boxplot visualizes the median, first quartile, and third quartile of a dataset.*The length of the box in a boxplot …

## What you'll create

Portfolio projects that showcase your new skills

## How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory