Hello,

I am using a grid.layout for combining multiple ggplot-plots.
So far I am doing it this way to get a pdf/eps:

pdf("/path/to/my/file.pdf") #or postscript("/path/to/my/file.eps")
grid.newpage()
pushViewport(viewport(layout = grid.layout(nrow=2, ncol=2,
                        widths = unit(c(7.5,7), "cm"),
                heights = unit(rep(5, 2), "cm"))))
print(plot1, vp = viewport(layout.pos.row = 1, layout.pos.col = 1))
print(plot2, vp = viewport(layout.pos.row = 1, layout.pos.col = 2))
print(plot3, vp = viewport(layout.pos.row = 2, layout.pos.col = 1))
dev.off()

With that method I get really nice plots but there is much white space
around them. I'd like to crop the pdf/eps automatically to the maximum
extend of the plot. How can that be done? Is that a setting with viewport?

Thank you very much for your help

/Johannes


--

______________________________________________
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