Re: [R] multiple plots in R

From: Felipe Carrillo <mazatlanmexico_at_yahoo.com>
Date: Sun, 23 Nov 2008 19:05:31 -0800 (PST)


Here's one way with ggplot2

library(ggplot2)
p <- qplot(mpg, wt, data=mtcars)
vplayout <- function(x, y)
viewport(layout.pos.row=x, layout.pos.col=y) grid.newpage()
pushViewport(viewport(layout=grid.layout(3,3)))

print(p, vp=vplayout(1,1))
print(p, vp=vplayout(1,2))
print(p, vp=vplayout(1,3))
print(p, vp=vplayout(2, 1))
print(p, vp=vplayout(2, 2))
print(p, vp=vplayout(2, 3))
print(p, vp=vplayout(3, 3))

Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish & Wildlife Service
California, USA

> From: Suyan Tian <stian_at_mail.rockefeller.edu>
> Subject: [R] multiple plots in R
> To: r-help_at_r-project.org
> Date: Sunday, November 23, 2008, 6:19 PM
> Hi, I just try to draw multiple plots in one page using R, I
> used par command. For example I have 7 plots, but instead of
> arranging them in the default way
>
> plot1 plot2 plot3
> plot4 plot5 plot6
> plot7
>
> I want them in this order
> plot1 plot2 plot3
> plot4 plot5 plot6
> plot7
>
> Could somebody tell me how to do this, please? Thanks so
> many.
>
>
> Suyan
>
> ______________________________________________
> 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.



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. Received on Mon 24 Nov 2008 - 03:12:49 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 24 Nov 2008 - 05:30:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive