Get startedGet started for free

Box and whisker plot

A box and whisker plot gives information regarding the shape, variability, and center (or median) of a data set. It is particularly useful for displaying skewed data.

By comparing the data set to a standard normal distribution, you can identify departure from normality (asymmetry, skewness, etc). The lines extending parallel from the boxes are known as whiskers, which are used to indicate variability outside the upper and lower quartiles, i.e. outliers. Those outliers are usually plotted as individual dots that are in-line with whiskers.

In the video, you also saw how to use boxplot() to create a horizontal box and whisker plot:

> boxplot(amazon_stocks,
          horizontal = TRUE,
          main = "Amazon return distribution")

In this exercise, you will draw a box and whisker plot for Apple stock returns in rtn, which is in your workspace.

This exercise is part of the course

Visualizing Time Series Data in R

View Course

Exercise instructions

  • Draw a box and whisker plot of the data in rtn
  • Draw a box and whisker plot for a standard normal distribution with 1000 points, which you can create with rnorm(1000)
  • Redraw both plots, in their original order, on the same 2x1 graphical window and make them horizontal

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Draw box and whisker plot for the Apple returns


# Draw a box and whisker plot of a normal distribution


# Redraw both plots on the same graphical window


Edit and Run Code