【发布时间】:2021-01-21 15:38:58
【问题描述】:
如何避免我的曲线(绿线)被切断?
x <- Phoenix_August_clean$Sum.Precipitation.Total.August
curve(dnorm(x, mean = fit.gaussian2$estimate[1], sd = fit.gaussian2$estimate[2]), lwd=3, col="red", add=TRUE)
curve(dgamma(x, fit.gamma.mme$estimate[1], fit.gamma.mle$estimate[2]), col="orange", lwd=3, add=TRUE) #Maximum likelihood
curve(dgamma(x, fit.gamma.mme$estimate[1], fit.gamma.mme$estimate[2]), col="green", lwd=3, add=TRUE) #Method of moments
legend("topright",legend=c("Normal","Gamma - ML","Gamma - MM"), col=c("red","orange","green"), lty=1, lwd=1)
结果:
【问题讨论】:
-
绘图会根据第一个绘图函数中显示的数据自动设置
ylim(据称是hist的某种形式),但它是在您添加超出限制的线之前设置的.手动设置ylim=。
标签: r plot histogram probability