Dear all,
I'd appreciate any hints how to arrange some plots.
I have three plots. I would like to arrange them in the following order:
- Plot 1 and Plot 2 should be in the upper row
- Plot 3 should be in the lower row but centered in the middle.
I hope the following sketch will help understanding my problem
===============| === === |
|| P1| |P2 | |
|| | | | |
| === === |
| ==== |
| |P3 | |
| | | |
| ==== |
===============
I tried already things
split.screen(c(2,1))
split.screen(c(1,2), screen=1)
screen(3)
### plotting of Plot 1
screen (4)
### plotting of Plot 2
screen(2)
### plotting of Plot 3
close.screen()
but then Plot 3 will be stretched across the whole screen (would be
screen(2)) and I would like to have it just the same width as the other
plots 1 and 2.
Can anyone give me some hints?
Thank you very much!
Roland
+++++
This mail has been sent through the MPI for Demographic Rese...{{dropped}}
On May 19, 2005, at 6:42 AM, Rau, Roland wrote:> Dear all, > > I'd appreciate any hints how to arrange some plots. > I have three plots. I would like to arrange them in the following > order: > - Plot 1 and Plot 2 should be in the upper row > - Plot 3 should be in the lower row but centered in the middle. > > I hope the following sketch will help understanding my problem > ===============> | === === | > || P1| |P2 | | > || | | | | > | === === | > | ==== | > | |P3 | | > | | | | > | ==== | > ===============Roland, You might want to look into grid graphics. The link here has lots of info. http://www.stat.auckland.ac.nz/~paul/grid/grid.html Sean
Rau, Roland wrote:> > Can anyone give me some hints? >?screen tells you: figs: A two-element vector describing the number of rows and the number of columns in a screen matrix _or_ a matrix with 4 columns. If a matrix, then each row describes a screen with values for the left, right, bottom, and top of the screen (in that order) in NDC units, that is 0 at the lower left coner - so by passing a matrix you can put plots anywhere, not just split the whole thing into boxes. Here's an example, which with a bit of tweaking, might work for you: > fm=rbind(c(0,.4,.6,.9),c(.6,.9,.6,.9),c(.3,.8,.1,.4)) > fm [,1] [,2] [,3] [,4] [1,] 0.0 0.4 0.6 0.9 [2,] 0.6 0.9 0.6 0.9 [3,] 0.3 0.8 0.1 0.4 each row of fm is (left, right, bottom, top) as a fraction of the whole device. > split.screen(fm) > screen(1) > plot(1:10) > screen(2) > hist(runif(100)) > screen(3) > plot(1:10) I've left some space around that you might want to get rid of. Its 90% there. Baz
Try this:
layout(matrix(c(1,0,2,0,3,0),2,3,byrow=TRUE))
plot(runif(10),main="P1")
plot(runif(10),main="P2")
plot(runif(10),main="P3")
Regards,
Pierre Lapointe
Assistant Market Strategist
National Bank Financial
***********************************************************************************
AVIS DE NON-RESPONSABILITE:\ Ce document transmis par courri...{{dropped}}
Dear all,
thank you very much for your help.
I would like to thank Sean Davis, Barry Rowlingson, and Pierre Lapointe
for their fast help.
I actually use now the approach suggested by Barry Rowlingson via the
split.screen() function.
Thanks,
Roland
P.S. Three solutions in 30 minutes...and the one which was most
convenient for me after 7 minutes. Hard to beat by any other software.
:-)
+++++
This mail has been sent through the MPI for Demographic Rese...{{dropped}}
Using layout(matrix(c(1,1,2,2,0,3,3,0),2,3,byrow=TRUE)) may be closer to what the original intent was. Greg Snow, Ph.D. Statistical Data Center, LDS Hospital Intermountain Health Care greg.snow at ihc.com (801) 408-8111>>> "Lapointe, Pierre" <Pierre.Lapointe at nbf.ca> 05/19/05 05:51AM >>>Try this: layout(matrix(c(1,0,2,0,3,0),2,3,byrow=TRUE)) plot(runif(10),main="P1") plot(runif(10),main="P2") plot(runif(10),main="P3") Regards, Pierre Lapointe Assistant Market Strategist National Bank Financial *********************************************************************************** AVIS DE NON-RESPONSABILITE:\ Ce document transmis par courri...{{dropped}} ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html