graph2pdf {lazy.tools} | R Documentation |
Output the Graphics to PDF Device
graph2pdf(
outpdf,
close = 0,
paper = "a4r",
height = 0,
width = 0,
onefile = TRUE,
...
)
outpdf |
The output pdf file name. When onefie=FALSE, give a C integer format such as "Rplot%03d.pdf". |
close |
= 1 to close the pdf device. |
paper |
Size of the pdf paper: "a4", "letter", "legal" and "executive", or "a4r" and "USr" for rotated (landscape.) |
height |
Height of the pdf paper in mm (not inches) |
width |
Width of the pdf paper in mm (not inches) |
onefile |
= FLASE to create many files. |
... |
Other arguments to native pdf function. |
This function calls native pdf function as:
pdf(outpdf, paper=paper, height=height, width=width
, onefile=onefile, ... )
When paper=NULL or "special", the paper size will be determined by
width and hight.
The defalt paper size is "a4r" which is equivalent to:
paper="special", height=210, width=297
## Not run:
plot(-5:5,(-5:5)^2, type="l", main="square")
plot(-5:5,(-5:5)^3, type="l", main="cubic")
# put everything in one pdf file
graph2pdf("testestestest.pdf")
plot(-5:5,(-5:5)^2, type="l", main="square")
plot(-5:5,(-5:5)^3, type="l", main="cubic")
graph2pdf(close=1)
# create one pdf file for each graph with automatic naming
graph2pdf("testestestest%03d.pdf", onefile=FALSE)
plot(-5:5,(-5:5)^2, type="l", main="square")
plot(-5:5,(-5:5)^3, type="l", main="cubic")
graph2pdf(close=1)
# create one pdf file for each graph with specific name
for( i in 1:3 ){
fname=paste("f", i, ".pdf", sep="")
graph2pdf(fname)
plot(-5:5,(-5:5)^i, type="l", main=i)
}
graph2pdf(close=1)
# default paper size: paper="a4r"
graph2pdf("test0.pdf")
plot(-5:5,(-5:5)^2, type="l", main="test")
graph2pdf(close=1)
# ??
graph2pdf("test00.pdf", paper="a4")
plot(-5:5,(-5:5)^2, type="l", main="test")
graph2pdf(close=1)
# paper size with width and height
graph2pdf("test1.pdf", paper="a4r", width=197, height=120)
plot(-5:5,(-5:5)^2, type="l", main="test")
graph2pdf(close=1)
# Below two produces the same pdfs.
graph2pdf("test2.pdf", paper=NULL, width=197, height=120)
plot(-5:5,(-5:5)^2, type="l", main="test")
graph2pdf(close=1)
graph2pdf("test3.pdf", paper="special", width=197, height=120)
plot(-5:5,(-5:5)^2, type="l", main="test")
graph2pdf(close=1)
## End(Not run)