Hesen Peng wrote:
> 
> 
> Thanks a lot for reminding me of this. The original code is too
> complicated and stems from several other objects. So I guess this
> simplified code may help:
> 
> a <- rnorm(100)
> class(a) <- "foo"
> 
> plot.foo <- function(data){
> ##  opar<-par()
>   par(mfcol=c(1,2))
>   hist(data)
>   boxplot(data)
> ##  par(mfcol=c(1,1))
> }
> 
> par(mfcol=c(2,2))
> plot(a)
> plot(a)
> plot(a)
> plot(a)
> 
> I'm hoping to have 2x2 plots of the plot.foo result. But the par()
> argument above seem to be overwriting each other. I tried the code
> suggested by Erin ( now in commented area). But it doesn't seem to
> work, either. Anyone has any suggestions? Thanks a lot,
> 

This comes close to the code I suggested. What you want sounds reasonable,
but old style graphics was not build to easily handle the nested situation
you want. May I suggest to use trellis graphics for this? It gives much
nicer pictures, and it is build on grid, which is nothing else than the
nesting idea (of viewport) carried to the glorious end.

Dieter


-- 
View this message in context: 
http://www.nabble.com/Multiple-use-of-par%28%29-tp22876693p22883934.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org 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.

Reply via email to