[R] height of plots

Jim Lemon jim at bitwrit.com.au
Mon Jan 30 09:58:24 CET 2012


On 01/30/2012 07:24 AM, 1Rnwb wrote:
> Hello R gurus,
>
>   I have to create 12 plots, I have been using the following script, which
> leaves a large white space between two plot. I would appreciate if someone
> can suggest an alternative to reduce the white space.
> par(mar=c(3,3,.5,.5))
> split.screen(c(6,2))        # split display into two screens
>
> for (i in 1:12)
> {
>
> if (i<11)
> {
> screen(i)
> plot(1:10,xaxt='n', xlab='', ylab='')
> box()
> }else{
> screen(i)
> plot(1:10, xlab='', ylab='', cex=0.75)
> box()
> }
> }
>
Hi Sharad,
Specify your margins like this:

split.screen(c(6,2))
for (i in 1:12) {
  if (i<11) {
   screen(i)
   par(mar=c(0.5,3,0,0.5))
   plot(1:10,xaxt='n', xlab='', ylab='')
   box()
  }
  else {
   screen(i)
   par(mar=c(3,3,0,0.5))
   plot(1:10, xlab='', ylab='', cex=0.75)
  }
}

Jim



More information about the R-help mailing list