[R] Passing par()-parameters to many plot()s in a function

Alexx Hardt mikrowelle1234 at gmx.de
Fri Dec 3 18:22:02 CET 2010


Hi,
I am implementing a function which generates about 10 .pdf plots in the 
current directory.
I need the graphic to fit into a LaTeX-Presentation-slide, so the outer 
margin should be removed (this is the way to do it, right?):

I am having trouble finding out where to put the par command(s). Is one 
enough or should I put them before and after /every/ plot() command?
This is how I tried to do it (without success):

clu <- function(x,k=3){

   cat("pwd: ",getwd(),"\n")
   pdf(file="img%03d.pdf",onefile=FALSE)
   op <- par(oma=c(0,0,0,0))
# more lines, 10 plot() commands, etc
   par(op)
   return(stuff)
}

-- 
alexx at alexx-fett:~$ vi .emacs



More information about the R-help mailing list