Skip to content

superimpose density line over hist

1 message · rahul143

#
........ 

    Romain> A few comments : 
    Romain> - your code should be reproductible, otherwise it is useless.
(that 
    Romain> recommandation is on the posting guide) 

    Romain> - that question is a top ten question on that list, go to the
archive 
    Romain> and you will find answers. (also posting guide) 
    Romain> BTW, it should be a FAQ and what about an example of overlaying
in hist 
    Romain> help page ? 

What about the following one --- do also note the comments though! 

set.seed(14) 
x <- rchisq(100, df = 4) 

## Comparing data with a model distribution should be done with qqplot()! 
qqplot(x, qchisq(ppoints(x), df = 4)); abline(0,1, col = 2, lty = 2) 

## if you really insist on using hist() ... : 
hist(x, prob = TRUE, ylim = c(0, 0.2)) 
curve(dchisq(x, df = 4), col = 2, lty = 2, lwd = 2, add = TRUE) 




-----
   TO GET MORE DETAILS CLICK HERE  





--
View this message in context: http://r.789695.n4.nabble.com/Re-superimpose-density-line-over-hist-tp4651671.html
Sent from the R help mailing list archive at Nabble.com.