Skip to content
Prev 106630 / 398525 Next

plotting time series with zoo pckg

AA
Dear Gabor,
sorry for not posting the code. below I have a piece of code that generates
a multivariate zoo data (3 columns) and graphs it using the axis
commands to generate the labels. This does not work. However, if one
extracts one column the labelling works using the same commands!
I cannot figure out what I am missing here.
Thanks for any suggestion.
AA.
I am using R version 2.4.0 (windows XP) and zoo package version 1.2-1(2006-09-20).


#-----Begin------------------------------------------
# Let's take the previous example to create a simple zoo data.
 z <- structure(c(21,34,33,41,39,38,37,28,33,40),
                index = structure(c(8044,8051,8058,8065,8072,
                8079,8086,8093,8100,8107), class="Date"), class = "zoo")

# generating 3 random vectors with the same length as z.
jx1 <- rnorm(10); jx2 <- rnorm(10); jx3 <- rnorm(10)
# create a zoo class data using the random vectors.
jx  <- cbind(jx1,jx2,jx3)
z1  <- zoo(jx, index(z))
# now we just repete the previous example.
plot(z1, xaxt = "n")
axis(1, time(z1), lab = FALSE)
jd <- time(z1)[seq(1, dim(z1)[[1]], 3)]
axis(1,jd, as.character(jd),cex.axis = 0.8, tcl = -0.7, las = 2)
# now we extract one column of z1 and graph it with the same axis commands.
z2 <- z1[,1, drop = F]
windows()
plot(z2, xaxt = "n")
axis(1, time(z2), lab = FALSE)
jd <- time(z2)[seq(1, dim(z2)[[1]], 3)]
axis(1,jd, as.character(jd),cex.axis = 0.8, tcl = -0.7, las = 2)
#-------------------End-----------------------------------

----- Original Message ----
From: Gabor Grothendieck <ggrothendieck at gmail.com>
To: ahmad ajakh <aajakh at yahoo.com>
Cc: r-help at stat.math.ethz.ch
Sent: Tuesday, December 26, 2006 11:17:44 PM
Subject: Re: [R] plotting time series with zoo pckg

Please read the last line of every message to r-help and follow that.
On 12/26/06, ahmad ajakh <aajakh at yahoo.com> wrote: