jpm miao
2016-Apr-10 00:20 UTC
[R] How to print the graphs in landscape/portrait orientation (revised)
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]]
Reasonably Related Threads
- How to print the graphs in landscape/portrait orientation
- [FORGED] can't print ggplot with Chinese characters to pdf files
- [FORGED] can't print ggplot with Chinese characters to pdf files
- can't print ggplot with Chinese characters to pdf files
- [FORGED] can't print ggplot with Chinese characters to pdf files
