Re: [R] multiple plots in single frame: 2 upper, 1 lower
On Wed, 2011-07-20 at 23:38 +1200, Rolf Turner wrote: On 20/07/11 11:07, DrCJones wrote: Hi, par(mfrow = c(2,2)) will create a 2x2 window that I can use to plot 4 diferent figures in: [plot1 plot2] [plot3 plot4] But how can do 3 so that the bottom spans the width of the upper two: [plot1 plot1] [p l o t 3] Is this possible in R? In R ***anything*** is possible. :-) Your requirement is no only possible, but easy! See ?layout You may have to expend a bit of effort to understand the syntax, but that will be good for your karma. :-) It may help the OP to think of the layout as a 2*2 matrix: 1 2 3 4 say, with plot 3 using regions 3 and 4. If we fill the same matrix with the plot number we want to draw in it, we have 1 2 3 3 From there it is easy to specify the layout by directly building that matrix in R: (m - matrix(c(1:3,3), ncol = 2, byrow = TRUE)) [,1] [,2] [1,]12 [2,]33 and pass that to `layout()` layout(m) ## invisible() just to stop replicate returning something visible invisible(replicate(3, plot(1:10))) layout(1) HTH G It ***will*** do exactly what you want, if you ask it nicely. cheers, Rolf Turner __ 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. -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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.
Re: [R] multiple plots in single frame: 2 upper, 1 lower
Layout did it! Thanks guys :) -- View this message in context: http://r.789695.n4.nabble.com/multiple-plots-in-single-frame-2-upper-1-lower-tp3679574p3683144.html Sent from the R help mailing list archive at Nabble.com. __ 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.
[R] multiple plots in single frame: 2 upper, 1 lower
Hi, par(mfrow = c(2,2)) will create a 2x2 window that I can use to plot 4 diferent figures in: [plot1 plot2] [plot3 plot4] But how can do 3 so that the bottom spans the width of the upper two: [plot1 plot1] [p l o t 3] Is this possible in R? -- View this message in context: http://r.789695.n4.nabble.com/multiple-plots-in-single-frame-2-upper-1-lower-tp3679574p3679574.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] multiple plots in single frame: 2 upper, 1 lower
Hi, Try looking at ?layout. Here is a simple example: layout(matrix(c(1, 2, 3, 3), 2, byrow = TRUE)) plot(1:10); plot(11:20); plot(21:40) Cheers, Josh On Tue, Jul 19, 2011 at 4:07 PM, DrCJones matthias.godd...@gmail.com wrote: Hi, par(mfrow = c(2,2)) will create a 2x2 window that I can use to plot 4 diferent figures in: [plot1 plot2] [plot3 plot4] But how can do 3 so that the bottom spans the width of the upper two: [plot1 plot1] [p l o t 3] Is this possible in R? -- View this message in context: http://r.789695.n4.nabble.com/multiple-plots-in-single-frame-2-upper-1-lower-tp3679574p3679574.html Sent from the R help mailing list archive at Nabble.com. __ 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. -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles https://joshuawiley.com/ __ 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.
Re: [R] multiple plots in single frame: 2 upper, 1 lower
DrCJones wrote: But how can do 3 so that the bottom spans the width of the upper two: [plot1 plot1] [p l o t 3] ?layout for standard graphics (plot..), but that's what you are referring to. For trellis, you must use other methods. Dieter -- View this message in context: http://r.789695.n4.nabble.com/multiple-plots-in-single-frame-2-upper-1-lower-tp3679574p3680128.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] multiple plots in single frame: 2 upper, 1 lower
On 20/07/11 11:07, DrCJones wrote: Hi, par(mfrow = c(2,2)) will create a 2x2 window that I can use to plot 4 diferent figures in: [plot1 plot2] [plot3 plot4] But how can do 3 so that the bottom spans the width of the upper two: [plot1 plot1] [p l o t 3] Is this possible in R? In R ***anything*** is possible. :-) Your requirement is no only possible, but easy! See ?layout You may have to expend a bit of effort to understand the syntax, but that will be good for your karma. :-) It ***will*** do exactly what you want, if you ask it nicely. cheers, Rolf Turner __ 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.