s-news
[Top] [All Lists]

Re: Graphing multiple time series

To: Jody McIntyre <jody_mcintyre99@yahoo.com>, s-news@lists.biostat.wustl.edu
Subject: Re: Graphing multiple time series
From: "Richard M. Heiberger" <rmh@temple.edu>
Date: Tue, 13 Dec 2005 18:07:00 -0500
This is the basics.  The first plot needs a key (legend) and various
other niceties. I also show a trellis because I think there will be too much
overlap in the superpose plot.  I think you would want to sort the cities
by average temperature, not by alphabet.

tmp <- data.frame(year=rep(1901:1910, 3),
                  city=rep(c("NYC","BOS","PHL"), c(10,10,10)),
                  temp=c(
                    NA,NA,rnorm(8,70,4),
                    NA,NA,rnorm(8,70,4),
                    NA,NA,rnorm(8,70,4)))

xyplot(temp ~ year, data=tmp, type="l", groups=city, panel=panel.superpose)

xyplot(temp ~ year | city, data=tmp, type="l", layout=c(10,3))


Rich

<Prev in Thread] Current Thread [Next in Thread>