我试图绘制一个标准错误的简单条形图,它让我疯狂。我确实查了一些例子并得到了这个:
rt5 <- data.frame(rtgrp=c(37.2,38.0,38.3,38.5,38.9),
mort=c(35,11,16,8,4),
se=c(0.08,0.01,0.005,0.01,0.02))
rt5
xvals=with(rt5,
barplot(mort,names.arg=rtgrp,
xlab="PTEMP_R group mean",ylab="%",ylim=c(0,max(mort+10+se))))
我正试图通过脚本的最后一行,但已经有很长一段时间了:
with(rt5,
arrows(xvals,mort,xvals,mort+se,length=45,angle=90,code=3))
我真的很想克服这个!
谢谢,
Baz
答案 0 :(得分:3)
length
是箭头的大小(错误栏的宽度):
45比你的情节大得多。
值越小越好。
with(rt5,
arrows(
xvals,mort,xvals,mort+se,
length=.3, angle=90, code=3,
# Change the colour and line width, to see the error bars
col="navy", lwd=5
)
)