-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
When writing multiple pages to a cairo_pdf device and paginating with grid.newpage() only the last page is retained in the pdf file. Workaround: use the pdf device (some functionality may be lost).
require("ggplot2")
x<-1:10
y<-x^2
df<-data.frame(x,y)
cairo_pdf("cairo_pdf.pdf", width=5, height=5)
ggplot(df) + aes(x,y) + geom_point() + opts(title="plot 1")
grid.newpage()
ggplot(df) + aes(x,y) + geom_point() + opts(title="plot 2")
grid.newpage()
ggplot(df) + aes(x,y) + geom_point() + opts(title="plot 3")
dev.off()
pdf("pdf_pdf.pdf", width=5, height=5)
ggplot(df) + aes(x,y) + geom_point() + opts(title="plot 1")
grid.newpage()
ggplot(df) + aes(x,y) + geom_point() + opts(title="plot 2")
grid.newpage()
ggplot(df) + aes(x,y) + geom_point() + opts(title="plot 3")
dev.off()