【发布时间】:2018-06-01 11:32:35
【问题描述】:
非常感谢社区对我的小 R 问题的帮助。我到处搜索,但还没有找到解决方案。
我的数据如下所示:
trait2 <- c('A','B','C','D')
rg <- c (0.5480, 0.4801, 0.2805, -0.2480)
se <- c(0.0495, 0.0908, 0.0548, 0.0957)
trait2 rg se
A 0.5480 0.0495
B 0.4801 0.0908
C 0.2805 0.0548
D -0.2480 0.0957
我使用这段代码绘制了一个基本的条形图:
barplot1 <- barplot(data$rg,
main="correlation between traits",
xlab="rG",
border="blue",
las=1,
horiz=TRUE,
names.arg=data$trait2,
cex.names=0.5,
xlim=range(-0.4,0.6,0.1) )
效果很好:
但我在使用此代码时遇到错误栏问题:
arrows(barplot1,
data$rg- data$se,
data$rg+ data$se,
lwd= 1.5,angle=90,code=3,length=0.05)
出现错误栏,但没有出现在它们应该出现的位置:
这可能很简单,但如果有人能帮助我,我会非常感激。 最好的,阿伦
【问题讨论】: