Graphics Reference
In-Depth Information
Figure 6-19. A notched box plot
Discussion
Notches are used in box plots to help visually assess whether the medians of distributions differ.
If the notches do not overlap, this is evidence that the medians are different.
With this particular data set, you'll see the following message:
Notch went outside hinges. Try setting notch=FALSE.
This means that the confidence region (the notch) went past the bounds (or hinges) of one of the
boxes. In this case, the upper part of the notch in the middle box goes just barely outside the box
body, but it's by such a small amount that you can't see it in the final output. There's nothing
inherently wrong with a notch going outside the hinges, but it can look strange in more extreme
cases.
Adding Means to a Box Plot
Problem
You want to add markers for the mean to a box plot.
Solution
Use stat_summary() . The mean is often shown with a diamond, so we'll use shape 23 with a
white fill. We'll also make the diamond slightly larger by setting size=3 ( Figure 6-20 ):
Search WWH ::




Custom Search