Hi,
I made a few graphs by ggplot. The following codes produce a pdf file with graphs, sometimes in landscape orientation, sometimes in portrait orientation. I am using both Mac and Windows PC. Question: how can I control the orientation of the pdf file? I try to add a line pdf(paper = “USr”) (or pdf(paper="letter")) in the following code, but it does not work. Thanks!! ################# library(ggplot2) library(grid) library(gridExtra) # Output graphs to files n<-100 p2<-array(list(NA),dim=n) # pdf(paper = "Usr") # pdf(paper = "letter") for(i in 1:n) { p2[i][[1]]<-ggplot(data.frame(x=1:(i+1), y=seq(2,2*(i+1),2)), aes(x=x, y=y))+ geom_line(color="blue") } m2 <- marrangeGrob(p2, nrow=3, ncol=2) ggsave("test_160409xyz.pdf", m2) ################## [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.