OK, this was a silly example. This one should be not as silly:
## Created example dataset data1 = matrix(1:12, nrow=4, ncol=3) data1 = data.frame(matrix(data1, 4, 3, byrow = T)) colnames(data1) = c("y1", "y2","x") data2 = data.frame(c(1,1,2,2)) colnames(data2) =c("z") data = cbind(data1,data2) load(lattice) ## Create 2 graphs with the xyplot command graph1= xyplot(y1~x|z, data = data) graph2 = xyplot(y2~x|z, data = data) ## Print both graphs on the same page print(graph1, split = c(1,1,1,2), more = T) print(graph2, split = c(1,2,1,2), more = F) ## There is a lot of white space between both graphs in the y direction. ## Since the plots share the same x axis I was wondering if there is a way to ## concatenate the plots to eliminate the white space in the y direction? Deepayan Sarkar wrote: > > On 1/30/08, eite2335 <[EMAIL PROTECTED]> wrote: >> >> OK - here is an example: >> >> ## Create example data >> >> data = matrix(1:8, nrow=4, ncol=2) >> >> ## Name columns "x" and "y" >> >> colnames(data) = c("x", "y") >> >> data = data.frame(data) >> >> ## Create 5 graphs with the xyplot command >> >> graph1= xyplot(y~x, data = data) >> graph2 = xyplot(y~x, data = data) >> graph3 = xyplot(y~x, data = data) >> graph4 = xyplot(y~x, data = data) >> graph5 = xyplot(y~x, data = data) >> >> ## Print all five graphs on the same page >> >> print(graph1, split = c(1,1,1,5), more = T) >> print(graph2, split = c(1,2,1,5), more = T) >> print(graph3, split = c(1,3,1,5), more = T) >> print(graph4, split = c(1,4,1,5), more = T) >> print(graph5, split = c(1,5,1,5), more = F) >> >> >> ## Note that there is a lot of white space between each graph in the y >> direction. >> ## Since the plots share the same x axis I was wondering if there is a >> way >> to >> ## concatenate the plots to eliminate the "wasted" white space in the y >> direction >> ## and make the graphs themselves larger? > > This should work: > > graph1[c(1, 1, 1, 1, 1)] > > Of course, a silly example will only get you a silly solution. > > -Deepayan > > ______________________________________________ > 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. > > -- View this message in context: http://www.nabble.com/Concatenate-xyplots-tp15176344p15188083.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.