[R] ggplot2-grid/viewport and PNG

Paul Hiemstra paul.hiemstra at knmi.nl
Tue Sep 6 14:28:48 CEST 2011


 On 09/05/2011 09:59 AM, ashz wrote:
> Dear All,
>
> The following code save my graphs as pdf:
> pdf("j:/mix.pdf", width = 18, height = 16) 
>  grid.newpage() 
>  pushViewport(viewport(layout = grid.layout(3,1))) 
>  vplayout <- function(x, y) 
>  viewport(layout.pos.row = x, layout.pos.col = y) 
>  print(Aplot, vp = vplayout(1, 1)) 
>  print(Bplot, vp = vplayout(2, 1)) 
>  print(Cplot, vp = vplayout(3, 1))
> dev.off()
>
> How can I save it in PNG and maintain the same graph structure?
>
> Thanks
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/ggplot2-grid-viewport-and-PNG-tp3790866p3790866.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
see ?ggsave. btw, have you considered using facetting in stead of
plotting several plots manually?

Paul

-- 
Paul Hiemstra, Ph.D.
Global Climate Division
Royal Netherlands Meteorological Institute (KNMI)
Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
P.O. Box 201 | 3730 AE | De Bilt
tel: +31 30 2206 494

http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770



More information about the R-help mailing list