Chapter 8. Box and Whisker Plots

In this chapter, we will cover the following recipes:

  • Creating box plots with narrow boxes for a small number of variables
  • Grouping over a variable
  • Varying box widths by number of observations
  • Creating box plots with notches
  • Including or excluding outliers
  • Creating horizontal box plots
  • Changing box styling
  • Adjusting the extent of plot whiskers outside the box
  • Showing the number of observations
  • Splitting a variable at arbitrary values into subsets

Introduction

In this chapter, we will look at box and whisker plots in detail, which are a great form of visualization to summarize large amounts of data by showing Tukey's five-number summary: minimum, lower-hinge, median, upper-hinge, and maximum. Box plots are a good way to spot outliers and compare the key statistics for different variables or groups.

We will learn various stylistic and structural variations on how to adjust box plots in R (using the basic boxplot() command). In addition to changing the look of our box plots, we will also learn how to add additional useful information to them. We will start by looking at some basic arguments to change individual aspects of a box plot and slowly move to more advanced recipes that involve the use of multiple function calls and arguments to create more complex types of box plots.

As with the previous chapters, it's best to try out each recipe first with the example shown here and then with your own datasets so that you can fully understand each line of code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.81.153