When I add lines()
to hist()
I get unexplainable crossed lines, could you tell me why? Please
x <-
rgamma(100, shape = 1, rate = 2)
gamma_distr <-
fitdistr(x, densfun="gamma")
pdf_gamma <-
dgamma(x,
shape = gamma_distr$estimate[1],
rate = gamma_distr$estimate[2])
hist(x, 100, freq = FALSE)
lines(x = x, y = pdf_gamma, col="red")