DATA MINING
Desktop Survival Guide by Graham Williams |
|||||
Box and Whisker Plot: With Means |
The simple box plot is extended to include the mean of each column. The means are calculated using scipy, and plotted as a + (pch=3).
rows <- 100 cols <- 17 pdf("graphics/rplot-boxplot-means.pdf") dataset <- matrix(rnorm(rows*cols), nrow=rows, ncol=cols) means <- mean(as.data.frame(dataset)) boxplot(as.data.frame(dataset), notch=TRUE, at=1:17, xlim=c(0, cols+1), ylim=c(-4,4), xaxt='n') axis(side=1, at=1:17, labels=letters[1:17]) points(1:17, means, pch=3) dev.off() |