Of interest to the R user (but unfortunately, not to the follower of footy ) is how to reproduce the Contested Possessions box-plot using ggplot2. Now ggplot2 is a well known package in R - ggplot2 is a powerful and flexible system for creating chart graphics - it's promise is extra flexibility and power than one gets with the charting functions in Base R.
ggplot2 has two options:
- qplot - this is the quick plotting function
- ggplot2 - this is the full plotting function, allowing almost unlimited customisation
My aim is to produce the box-plots initially using qplot, and then to recreate the plot in ggplot2.
This code produces the box-plot using qplot:
byafl <- with(afl, reorder(V2,V1))
qplot(byafl,V3, data = afl, geom = "boxplot", xlab = "Teams - Ladder Order", ylab = "Contested Possessions Per Game", main = "Contested Posessions 2011")