Key Concepts

Review core concepts you need to learn to master this subject

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

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

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

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

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.5IQR above the third quartile and the lower whisker is the smallest dataset number larger than 1.5IQR below the first quartile.

Boxplot in Matplotlib

In Python’s Matplotlib library, the pyplot.boxplot() function takes a dataset as input and returns a box plot.

Boxplots
Lesson 1 of 1
  1. 1
    Boxplots 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…
  2. 2
    When 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 …
  3. 3
    Now 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…
  4. 4
    The 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 …
  5. 5
    The 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.
  6. 6
    We’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…
  7. 7
    Great 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

Pro Logo

How you'll master it

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

Pro Logo