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

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Fri Aug 17 10:02:38 CEST 2007


Dear Rainer,

Your could try something like this.

test <- try( plot(runif(ff)) )
if(class(test) == "try-error"){
	#put here code for an empty plot
}

Cheers,

Thierry
------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be
www.inbo.be 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney

 

> -----Oorspronkelijk bericht-----
> Van: r-help-bounces op stat.math.ethz.ch 
> [mailto:r-help-bounces op stat.math.ethz.ch] Namens Rainer M. Krug
> Verzonden: vrijdag 17 augustus 2007 9:49
> Aan: Greg Snow
> CC: r-help; Rainer+R-help op krugs.de
> Onderwerp: Re: [R] several plots on several pages - bug in par(mfg())?
> 
> 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 op uct.ac.za
> 
> RKrug op 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 op uct.ac.za
>        	Rainer op krugs.de
> 
> ______________________________________________
> R-help op 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
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list