Dear Rhelp,
I am trying to get multiple xyplots and barplots in the same page.? I
couldn't get it work.
Example code:
library(lattice)
library(grid)
xy <-xyplot(decrease ~ treatment, OrchardSprays,
??? main= "Some plot",
??????? groups = rowpos, type = "a",
???
scales=list(x=list(at=seq(1,8,1),labels=c('A','','C','','E','','G',''))),
??? ??????????? page???? = function(n){
???????????????????????? grid.text(LETTERS[j],
???????????????????????? y = 0.95,
???????????????????????? x = 0.15,
???????????????????????? default.units = "npc",
???????????????????????? just = c("left"),
???????????????????????? gp = gpar(fontsize = 12,fontface="bold") )
?????????????????????? },
??? par.settings = c(simpleTheme(lty=1:8,
col="black",lwd=2),list(axis.components=list(bottom=list(tck=c(0,1))),layout.heights
= list(main = 1.2,
?????????????????????? sub? = 0,
?????????????????????? axis.top = 0.2,
?????????????????????? top.padding? = 0.1,
?????????????????????? bottom.padding = 0,
??? ??? ??? axis.bottom=0.8)) ),
??????? auto.key = list(x = 0.2, y = 0.9,
??????? cex = 0.75, points = FALSE, lines = TRUE))
j=1
print(xy, pos = c(0.0, 0.50, 0.33, 0.95), more = TRUE)
j=j+1
print(xy, pos = c(0.33, 0.50, 0.66, 0.95), more = TRUE)
j=j+1
print(xy, pos = c(0.66, 0.50, 0.99, 0.95), more = TRUE)
j=j+1
print(xy, pos = c(0.0, 0.0, 0.33, 0.45), more = TRUE)
j=j+1
print(xy, pos = c(0.33, 0.0, 0.66, 0.45), more = TRUE)
j=j+1
counts <- table(mtcars$gear)
barplot(counts, main="Car Distribution",? #this part is not correct
?? xlab="Number of Gears")?
Thanks in advance,
Lisa