我想在y=2 (ylim=2)
testdata <- data.frame(group=c(1,2),
xbar= c(3.410821 , 4.746693 ),
se = c(0.1593839,0.2435023))
xvals = with(testdata,barplot(xbar, names.arg=group,
main="",xlab="x",ylab="y",ylim=c(2,max(6))))
with(testdata,arrows(xvals, xbar, xvals, xbar+se, length=0.3, angle=90, code=2))
答案 0 :(得分:1)
设置xpd
参数,如下所示:
xvals = with(testdata,barplot(xbar, names.arg=group,
main="",xlab="x",ylab="y",ylim=c(2,6),xpd=FALSE))