If several box plots are to be displayed on a graphic where the X-axis represents a unique level, but one which is continuous (like per-year over a very long study) is there a well known way to condense a large number of boxplots aside from the obvious of aggregating up by large subsets of the X?
1 Answer
Illustrating @gung's suggestion, here are boxplots (made in R)--one for each of 10 'years'.
Each boxplot shows 12 (simulated) 'monthly' values of a variable x
, which is gamma
distributed. Gamma shapes increase gradually from 2 to 8 during
the 120 months, and rates from about .32 to about .45.
Red line segments connect the averages for the 10 years. Such a graph is still clearly readable with 30 years instead of 10 (second figure).
# R code for first figure
set.seed(329) # for reproducibility
Month = 1:120
shape = seq(2, 8, len=120); rate = seq(.1,.2,len=120)^.5
x = rgamma(120, shape, rate)
Year = rep(1:10, each=12)
MAT = matrix(x, byrow=T, nrow=10) # a row for each year
a = rowMeans(MAT) # 10 averages
boxplot(x ~ Year, col="skyblue2", pch=19)
lines(1:10, a, type="l", lwd=2, col="red")
x <- sample(101:200,10000,replace=TRUE)
;y <- 50 + x/9.5 +5*sin(x/45)+ rnorm(10000)
;a <- boxplot(y~x)
However, you could just join the medians, quartiles and whisker-ends (this is rough but conveys the idea - you'd want to make a prettier version than this):matplot(t(a$stats),type="l")
$\endgroup$