Klaus Nordhausen
2008-Jun-09 16:18 UTC
[R] xyplot.zoo question about strip.left and layout
Dear R masters, I have large multivariate time series as zoo objects and want to plot them using lattice. Since I have many variates in one object I would like to have the strips on the left, using strip.left = TRUE. However when I use this the variable names are converted into numbers. How can I keep there the original variable names? (compare test1 and test2 in example below) Furthermore would I like to print one object using several pages, having only one column - I have however not always a "nice" number of panels (variables) and then often on the last page there is a huge gap between the last drawn panel and the axis label. How can that be avoided? Short example: library(zoo) library(lattice) set.seed(1) z <- zoo(cbind(a = 1:5, b = 11:15, c = 21:25, d = 31:35, e = 41:45) + rnorm(5)) test1<-xyplot(z, as.table=TRUE , strip=TRUE , strip.left=FALSE , layout=c(1,3,2)) test2<-xyplot(z, as.table=TRUE , strip=FALSE , strip.left=TRUE , layout=c(1,3,2)) trellis.device(device="pdf", color = FALSE, file="test_z.pdf", paper="a4" ,width = 6, height =10 ) print(test2) dev.off() Thanks already in advance! Klaus PS: I use R 2.7.0 on windows XP and lattice_0.17-8 and zoo_1.5-3. --
Hi, I'm not being able to represent the result of sprintf("%E", pi) [1] "3.141593E+00" Into this: "3.141593E+0000" Thanks in advance Paulo
Gabor Grothendieck
2008-Jun-09 18:10 UTC
[R] xyplot.zoo question about strip.left and layout
Try: strip.left = strip.custom(factor.levels = colnames(z)) On Mon, Jun 9, 2008 at 12:18 PM, Klaus Nordhausen <klausch at gmx.de> wrote:> Dear R masters, > > I have large multivariate time series as zoo objects and want to plot them using lattice. > > Since I have many variates in one object I would like to have the strips on the left, using strip.left = TRUE. However when I use this the variable names are converted into numbers. How can I keep there the original variable names? (compare test1 and test2 in example below) > > Furthermore would I like to print one object using several pages, having only one column - I have however not always a "nice" number of panels (variables) and then often on the last page there is a huge gap between the last drawn panel and the axis label. How can that be avoided? > > Short example: > > library(zoo) > library(lattice) > > set.seed(1) > z <- zoo(cbind(a = 1:5, b = 11:15, c = 21:25, d = 31:35, e = 41:45) + rnorm(5)) > > test1<-xyplot(z, as.table=TRUE , strip=TRUE , strip.left=FALSE , layout=c(1,3,2)) > test2<-xyplot(z, as.table=TRUE , strip=FALSE , strip.left=TRUE , layout=c(1,3,2)) > > trellis.device(device="pdf", color = FALSE, file="test_z.pdf", > paper="a4" ,width = 6, height =10 ) > print(test2) > dev.off() > > Thanks already in advance! > > Klaus > > PS: I use R 2.7.0 on windows XP and lattice_0.17-8 and zoo_1.5-3. > > > -- > > ______________________________________________ > R-help at 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. >
Gabor Grothendieck
2008-Jun-09 18:20 UTC
[R] xyplot.zoo question about strip.left and layout
Or perhaps this way is more logical since it takes the names from the screens: test2<-xyplot(z, as.table=TRUE , screens = colnames(z), strip=FALSE , strip.left = TRUE, layout=c(1,3,2)) On Mon, Jun 9, 2008 at 2:10 PM, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:> Try: > > strip.left = strip.custom(factor.levels = colnames(z)) > > > On Mon, Jun 9, 2008 at 12:18 PM, Klaus Nordhausen <klausch at gmx.de> wrote: >> Dear R masters, >> >> I have large multivariate time series as zoo objects and want to plot them using lattice. >> >> Since I have many variates in one object I would like to have the strips on the left, using strip.left = TRUE. However when I use this the variable names are converted into numbers. How can I keep there the original variable names? (compare test1 and test2 in example below) >> >> Furthermore would I like to print one object using several pages, having only one column - I have however not always a "nice" number of panels (variables) and then often on the last page there is a huge gap between the last drawn panel and the axis label. How can that be avoided? >> >> Short example: >> >> library(zoo) >> library(lattice) >> >> set.seed(1) >> z <- zoo(cbind(a = 1:5, b = 11:15, c = 21:25, d = 31:35, e = 41:45) + rnorm(5)) >> >> test1<-xyplot(z, as.table=TRUE , strip=TRUE , strip.left=FALSE , layout=c(1,3,2)) >> test2<-xyplot(z, as.table=TRUE , strip=FALSE , strip.left=TRUE , layout=c(1,3,2)) >> >> trellis.device(device="pdf", color = FALSE, file="test_z.pdf", >> paper="a4" ,width = 6, height =10 ) >> print(test2) >> dev.off() >> >> Thanks already in advance! >> >> Klaus >> >> PS: I use R 2.7.0 on windows XP and lattice_0.17-8 and zoo_1.5-3. >> >> >> -- >> >> ______________________________________________ >> R-help at 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. >> >