1

我想将条形图的限制固定在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))
4

1 回答 1

1

像这样设置xpd参数:

xvals = with(testdata,barplot(xbar, names.arg=group, 
                              main="",xlab="x",ylab="y",ylim=c(2,6),xpd=FALSE))

在此处输入图像描述

于 2013-07-08T13:04:25.300 回答