[R] Can't format x axis on a stacked plot of a zoo object

Gabor Grothendieck ggrothendieck at gmail.com
Tue Nov 13 23:53:21 CET 2012


On Tue, Nov 13, 2012 at 5:30 PM, Vindoggy ! <vindoggy at hotmail.com> wrote:
>
> As an example data set:
>
> set.seed(1)
> z.Date <- as.Date(paste(2003, 02, c(1, 3, 7, 9, 14), sep = "-"))
> z <- zoo(cbind(left = rnorm(5), right = rnorm(5, sd = 0.2)), z.Date)
>
> tt<-time(z)
>
>
>
> fmt<-"%b-%d"
>
> labs<-format(tt,fmt)
> plot(z[,1], xlab = "Time", ylab = "")
>
> If I plot the data and don't like the format of the x axis I can do this:
>
> plot(z[,1], xlab = "Time", ylab = "",xaxt="n")
>
> axis(side=1, at=tt[1:5],labels=labs[1:5],cex.axis=0.7)
>
> But if I want to do a stacked plot:
>
> plot(z, xlab = "Time", ylab = "",xaxt="n")
> axis(side=1, at=tt[1:5],labels=labs[1:5],cex.axis=0.7)
>

This is a FAQ.  See FAQ #8

   vignette("zoo-faq")

and also see the examples at the bottom of

   ?plot.zoo


--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com




More information about the R-help mailing list