ONKELINX, Thierry <Thierry.ONKELINX <at> inbo.be> writes:

> I have managed to create a figure on the screen with multiple plots in
> it. Something like the example below. When I save that with ggsave(),
> only the last plot gets saved (pPath in the example) instead of the
> entire figure. Any suggestions how I can save this kind of figures
> automated?

No idea what the easiest way would be if you want both window and 
pdf.

Dieter

library(ggplot2)
pPoint <- qplot(unemploy/pop, psavert, data=economics)
pPath <- qplot(unemploy/pop, psavert, data=economics, geom="path")

pdf(file="test.pdf")
pushViewport(viewport(layout = grid.layout(2, 1)))
print(pPoint, vp = viewport(layout.pos.row = 1, layout.pos.col = 1))
print(pPath, vp = viewport(layout.pos.row = 2, layout.pos.col = 1))
dev.off()

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to