Desktop Survival Guide
by Graham Williams

Box and Whisker Plot

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.

ds <- matrix(rnorm(19 * 100), ncol = 19)
  plot.window(xlim = c(0, 20), ylim = range(ds), xaxs = "i")
  boxplot(, add = TRUE, at = 1:19)

Copyright © Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
The PDF version is a formatted comprehensive draft book (with over 800 pages).
Brought to you by Togaware. This page generated: Sunday, 22 August 2010