R line()命令显示交叉线
当我把R line()命令显示交叉线,r,plot,line,R,Plot,Line,当我把line()添加到hist()时,我得到了无法解释的交叉线,你能告诉我为什么吗?请 x试试这个: 库(MASS) x因为行按给定值的顺序绘制:行(x[order(x)],pdf_gamma[order(x)],col=“red”) x <- rgamma(100, shape = 1, rate = 2) gamma_distr <- fitdistr(x, densfun="gamma") pdf_gamma <- dgamma(
line()
添加到hist()
时,我得到了无法解释的交叉线,你能告诉我为什么吗?请
x试试这个:
库(MASS)
x因为行
按给定值的顺序绘制:行(x[order(x)],pdf_gamma[order(x)],col=“red”)
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")