[R] several plots on several pages - bug in par(mfg())?

Rainer M. Krug Rainer at krugs.de
Fri Aug 17 09:49:28 CEST 2007


Greg Snow wrote:
> Oops, I read further down in your original post and see that you already
> knew about par(mfg=c(2,1)).  To get it to advance to page 2 for the 4th
> plot try calling plot.new() which should move you to the next page, then
> doing par(mfg=c(1,1)) should cause the next graph to be at the top.
> 
> Hope this helps,
> 

Thanks - I found plot.new() and it is working.

But: If the first plot command fails, par(mfg=c(2,1)) does NOT move to 
the second one - if you try the code below, you will see.

Is this a bug or am I doing something wrong?

## Set layout to three rows and only oine column
par( mfcol=c(3,1), oma=c(0,0,0,0), mar=c(4, 4, 2, 2) )

## First row
par(mfg=c(1,1))
try( plot(runif(ff)) ) ## plot fails due to something.

## Second row
par(mfg=c(2,1))
try( plot(runif(100)) ) ##actually is plotted in first row

## Third row
par(mfg=c(3,1))
plot(runif(1000))   ## plotted in third row


-- 
NEW EMAIL ADDRESS AND ADDRESS:

Rainer.Krug at uct.ac.za

RKrug at sun.ac.za WILL BE DISCONTINUED END OF MARCH

Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation
Biology (UCT)

Plant Conservation Unit
Department of Botany
University of Cape Town
Rondebosch 7701
South Africa

Tel:		+27 - (0)21 650 5776 (w)
Fax:		+27 - (0)86 516 2782
Fax:		+27 - (0)21 650 2440 (w)
Cell:		+27 - (0)83 9479 042

Skype:		RMkrug

email:	Rainer.Krug at uct.ac.za
       	Rainer at krugs.de



More information about the R-help mailing list