||
#在sciplot程序包里可以自动加误差线
install.packages("sciplot") #安装sciplot包
library(sciplot) #调用sciplot包
bargraph.CI(dose, len, data = ToothGrowth)
lineplot.CI(dose, len, data = ToothGrowth)
# 巧用箭头作为误差项方案,其实这个更实用,因为我们可以自己定误差线,或是置信区间的线
x = 1:5
y = c(1.1, 1.5, 2.9, 3.8, 5.2)
SD = c(0.1, 0.3, 0.2, 0.2, 0.4)
plot (x, y)
# add error bars (without adjusting yrange)
arrows(x, y-SD, x, y+SD, length=0.05, angle=90, code=3)
# new plot (adjusts Yrange automatically)
plot (x, y,ylim=c(1,6))
arrows(x, y-SD, x, y+SD, length=0.05, angle=90, code=3)
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-11-24 17:09
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社