[R] box-and-whisker plots based on summary not data
Matthew Vernon
M.C.Vernon at warwick.ac.uk
Mon Dec 20 14:33:54 CET 2010
Matthew Vernon <M.C.Vernon at warwick.ac.uk> writes:
> Is it possible to produce box-and-whisker plots given that I have the
> median, interquartile and 5/95th centile values, but not the data from
> which they come?
The answer, which came from Steve Ellison (thanks!) is to note that
"stats" is the only bit of the "z" argument to bxp that has to be
present, so given a data file with columns year,mean,median,centiles,
something like this works:
# transform data so the rows are the various centiles in order
# there's probably a more elegant approach!
bsr <- matrix(allobs[,c(4,5,3,6,7)],nrow=5,byrow=TRUE)
# column 1 is the year, which is our factor
bsbox <- list( stats=bsr,names=allobs$V1)
bxp(bsbox,xlab="Year",ylab="Number of cattle per batch")
I thought I'd follow-up so the answer to my question will be in the
archives.
Thanks,
Matthew
--
Matthew Vernon, Research Fellow
Ecology and Epidemiology Group,
University of Warwick
http://blogs.warwick.ac.uk/mcvernon
More information about the R-help
mailing list