Skip to content

grid.newpage() does not work with cairo_pdf #63

@markconnolly

Description

@markconnolly

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions