我在SigmaPlot中制作了这个数字,但是我想把它做成R.它是一个分组的条形图,SE条有3个由4个子组组成的组。我无法将数字与电子表格的顺序相匹配:
Treatment Guild mean se
Untreated Ground 0.46 1.1976
Treated Ground 0.79 1.1976
Reference Ground 0.88 1.1976
Untreated Cavity 0.87 1.1976
Treated Cavity 0.25 1.1976
Reference Cavity 1.63 1.1976
Untreated Canopy 15.13 1.1976
Treated Canopy 9.83 1.1976
Reference Canopy 23.8 1.1976
Untreated Shrub 7.79 1.1976
Treated Shrub 4.58 1.1976
Reference Shrub 5.92 1.1976
我的代码在这里:
library(sciplot)
data=read.csv
par(mfrow=c(1,1))
#figure3
fig=bargraph.CI(x.factor=Treatment,group=Guild, response=mean, data=data,ylim=c(0,30), cex.lab=0.9, cex.axis=1.0,
xlab="Habitat", names.arg=c("Untreated","Treated","Reference"), ylab="Mean abundance of birds/site (±SE)",
col=c("black","gray","white","gray30")
)
segments(fig$xvals,data$mean+data$se,fig$xvals,data$mean-data$se)
segments(fig$xvals-.05,data$mean+data$se,fig$xvals+.05,data$mean+data$se) #Add the top cap
segments(fig$xvals-.05,data$mean-data$se,fig$xvals+.05,data$mean-data$se) #Add the bottom cap
box(bty="l")
legend("topleft", bty="n", leg.lab=c("Ground", "Cavity", "Canopy", "Shrub"), col=c("black","gray","white","gray30"))
如何获得与数据文件匹配的均值和SE顺序?