Hi all,

I defined the following

#############################
myhist=function(x){
        hist(x,xlab="",main="")
        h=hist(x)
        xfit=seq(min(x),max(x),length=100)
        yfit=dnorm(xfit,mean(x),sd=sd(x))
        yfit=yfit*diff(h$mids[1:2])*length(x)
        lines(xfit, yfit, col="blue", lwd=2)
}
#############################

individually, it worked fine

however, if I used

par(mfrow=c(2,2))

each time i run myhist

it produces TWO plots,

one without the 'lines',
and one with the 'lines'

why is that??

Thanks.

casper
-- 
View this message in context: 
http://r.789695.n4.nabble.com/par-mfrow-in-function-problem-tp3036745p3036745.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