I would like to plot multiple zoo object lines on one plot. These are time 
series of temperatures derived from different sampling regimes (one is 
sub-hourly, and the other is bi-weekly). I understand that they need to be 
indexed in the same way to be plotted together, and so took my two zoo objects 
(Named DataNOAAZOO and NightTemps20m and transformed into similar daily means 
with this code: 

DailyNightTemps_20m = aggregate(NightTemps_20m, as.Date(time(NightTemps_20m)), 
mean)
DailyNightTemps_NOAA = aggregate(DataNOAAZOO$SST, as.Date(time(DataNOAAZOO)), 
mean)

One object now has ~4000 entries and the other ~1000 (one is every day and the 
other bi-weekly) but they are now on the same daily index (at least I believe 
they are, from my reading). Therefor I think they should plot together with 
this code: 

plot(DailyNightTemps_20m)
lines (DailyNightTemps_NOAA, col = "red")

(This is directly from the zoo instructions, which state: 
## univariate plotting
x <- zoo(rnorm(5), x.Date)
x2 <- zoo(rnorm(5, sd = 0.2), x.Date)
plot(x)
lines(x2, col = 2) )

But the second one does not show up at all and I get no error message.

I will be doing a similar operation with Monthly and Annual Means, and also 
similar plots with other parameters in the zoo (derived differences), so I want 
so solve this issue before moving on to the other variables. I did some reading 
before posting and tried various solutions, but I still cannot figure out why 
the basic instructions above do not work. 

I know this is a basic question, with a probably obvious answer, but it kept me 
up all night so thanks for any assistance. Ben Neal

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to