Re: [R] Questions related to plotting boxplots of time series data

From: Stephan Kolassa <>
Date: Wed, 16 Apr 2008 15:49:10 +0200

Hi Thomas,

> I have looked through several R books and searched the web to find
> answers to my questions with no results. I have an ensemble of time
> series data (what are essentially Monte Carlo simulations) which I would
> like to summarize as a time series of boxplots, by date/time at 6-hr
> intervals. I don't know how to do this and I am not sure how I should
> structure the data to get what I want. Another related question: while
> doing this, can I have some of the time series shorter than others?

Once you have a (say) matrix containing the data, you can build a time series of boxplots by feeding a formula to boxplot():

times <- seq(1:20)
values <- matrix(rnorm(20*100,0,1),nrow=20,ncol=100) boxplot(values~times)

Of course, you would need to align the time series values and take the six-hour-slices first. And then add prettyprinted labels.

> Ideally I would prefer to depict 99%, 95%, 75%, 50%, etc. confidence
> intervals to show the distribution of the data. Is this possible? How
> can I do it?

boxplot() by default shows 25%, 50% and 75% quantiles. The whiskers and circles are calculated through the interquartile range, see
Unfortunately, I can't seem to find this info in the help file for boxplot(). Thus, you would need to roll your own graphical representations after extracting quantiles via


or some such. If you do roll your own, just please don't do "nonstandard" boxplots without telling the reader that your "whiskers" mean something different than in the ordinary boxplot...

Hope that helped
Stephan mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 16 Apr 2008 - 14:01:58 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 16 Apr 2008 - 14:30:29 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive