Dear R-Experts, I can easily plot an histogram and its density curve. But when I try to add the Gauss curve on the histogram with the following Rcode here below, I don't get it. What is wrong ? Or what is missing in my code ?
##Plot an histogram h=hist(newdata$math.test, prob=TRUE, col="blue", border="white", xlab="Note test math", ylab="Densité", main="Test math") ##Add the density curve on the histogram lines(density(newdata$math.test,na.rm=TRUE),lwd=2,col="orange") ##Add the Gauss curve on the histogram x <- seq(from = min(newdata$math.test, na.rm=TRUE), to = max(newdata$math.test, na.rm=TRUE), lines(x, dnorm(x, mean(newdata$math.test, na.rm = TRUE), sd(newdata$math.test, na.rm = TRUE))) Best, thanks for your time. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.