如何修复条形图的下限

时间:2021-09-19 14:56:30

I want to fix the limit of the barplot at y=2 (ylim=2)

我想在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))

1 个解决方案

#1


1  

Set the xpd parameter like this:

像这样设置xpd参数:

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

如何修复条形图的下限

#1


1  

Set the xpd parameter like this:

像这样设置xpd参数:

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

如何修复条形图的下限