DATA MINING
Desktop Survival Guide by Graham Williams |
|||||
A simple box plot of randomly generated data. The box in each plot shows the median (as the line within the box) and one standard deviation from the mean (the extremes of the box). The whiskers show the second standard deviation, and the circles show outliers.
In this code we use R's rnorm function to generate a
standard_normal random matrix of the given shape (rows by cols). The
dataset is transformed to an R data frame. The x axis is labelled with
an appropriate number of letters from the alphabet.
set.seed(2) ds <- matrix(rnorm(19 * 100), ncol = 19) pdf("graphics/rplot-boxplot.pdf") plot.new() plot.window(xlim = c(0, 20), ylim = range(ds), xaxs = "i") boxplot(as.data.frame(ds), add = TRUE, at = 1:19) dev.off() |