Thanks Chris for the info on the layout function, though I stil managed to get it done by supplying a matrix to the split.screen function as suggested by "sgibb".
Dear All,
I ran into some problem while I was trying to visualise some data. Essentially I wrote a script in R which generates a pdf(a plot actually) for each of the gene that I am interested in. The pdf file has 2 panels.
To make these two panels, I split my screen first of all with the following command: split.screen( figs = c( 2, 1 ) ) ### Split my screen into 2 parts such that there is 1 column and two rows. Then, I just go about doing things in panel 1 and panel 2. For panel 1, I have to write the code under screen(1) while for panel 2, the code begins with screen(2). Everything works fine. My only issue is that I want to split the screen into unequal sizes. I would like panel 1 (screen 1) to occupy 70% of the final image and screen 2/panel 2 to occupy the rest. Any suggestions on how do I make changes to the split.screen command at the beginning ?
Thanks
2 answers
Try the layout() function, which will give you all sort of fine-grained control over where your plots go and how they're spaced:
For one example: http://stackoverflow.com/questions/3638773/r-add-extra-spacing-between-a-subset-of-plots
Please see ?split.screen section Arguments/figs for details:
coord <- matrix(c(c(0, 1, 0, 0.7), c(0, 1, 0.7, 1)), byrow=T, ncol=4)
split.screen(coord)
screen(1)
plot(1:10)
screen(2)
plot(1:10)
Thanks, the split.screen with the modification that you suggested worked fine.
Log in to answer this question.