[Solved] histogram and pdf in the same graph [duplicate]


h<-hist(data, breaks="FD", col="red", xlab="xTitle", main="Normal pdf and     histogram")
xfit<-seq(min(data),max(data),length=100)
x.norm<-rnorm(n=100000, mean=a, sd=b)
yfit<-dnorm(xfit,mean=mean(x.norm),sd=sd(x.norm))
yfit <- yfit*diff(h$mids[1:2])*length(loose_All)
lines(xfit, yfit, col="blue", lwd=2)

1

solved histogram and pdf in the same graph [duplicate]