In this recipe, we will learn how to make box plots with notches, which are useful in comparing the medians of different groups.
We will continue to use the metals.csv
example dataset for this recipe. So, let's first load it:
metals<-read.csv("metals.csv")
We shall now see how to make a box plot with notches:
boxplot(Cu ~ Source, data = metals, varwidth=TRUE,notch=TRUE, main="Summary of Copper concentrations by Site")
In the example, we set the notch
argument to TRUE
to create notches on each side of the boxes. If the notches of two plots do not overlap, then the medians are significantly different at the 5-percent level, which suggests that the median concentrations at the four sites as shown are not statistically different from each other.
18.116.42.136