Skip to content
Prev 371523 / 398506 Next

Shift the normal curve to the top or near to the top of the histogram

Hello,

Try using hist argument 'prob = TRUE' or, which is equivalent, 'freq = 
FALSE'.

hist(..., prob = TRUE)   # or hist(..., freq = FALSE)

This is because like this you will have a density, comparable to a 
parametric density. Note that the peak of the normal will be outside the 
plot area so you will have to adjust the plot area dimensions. In this 
case I've set 'ylim = c(0, 0.35)'.


hist(Lizard.tail.lengths, main = "Normal Probability Plot of Lizard Tail
Lengths", ylim = c(0, 0.35), prob = TRUE)

curve(dnorm(x ,mean=mean(Lizard.tail.lengths),sd=sd(Lizard.tail.lengths)),
add=TRUE, col=2, lwd = 2)


Hope this helps,

Rui Barradas

Em 25-09-2017 00:35, AbouEl-Makarim Aboueissa escreveu: