我一直在尝试使用以下数据创建“简单”条形图。此数据中的一列用于平均值,另一列用于SE。
直到尝试添加误差线时,我都可以使该图正常工作。两个错误栏没有显示,并且我收到以下错误消息
'警告消息:零长箭头的角度不确定,因此 跳过
警告消息:
1:在doTryCatch(return(expr),名称,parentenv, 处理程序):零长箭头的角度不确定,因此 跳过
2:在doTryCatch(return(expr),名称,parentenv,处理程序)中: 零长箭头的角度不确定,因此被跳过
我希望有人能告诉我我的代码怎么了以及如何向该图中添加错误条。
data1 <- read.table(text="season se mean intersource
Dryseason 2.9 28.5 Highgw
Dryseason 7 4 Lowgw
Dryseason 5.1 2.5 Midgw
Dryseason 13.4 37.9 Highrw
Dryseason 7.2 4.1 Lowrw
Dryseason 0.5 2.6 Midrw
Dryseason 17.9 33.6 Highsw
Dryseason 0.6 91.8 Lowsw
Dryseason 4.8 94.9 Midsw
Wetseason 1.7 1.7 Highgw
Wetseason 0.3 0.6 Lowgw
Wetseason 0.2 0.6 Midgw
Wetseason 5 95 Highrw
Wetseason 0.3 0.9 Lowrw
Wetseason 0.2 0.6 Midrw
Wetseason 0.6 0.2 Highsw
Wetseason 3.8 98.5 Lowsw
Wetseason 3.1 98.8 Midsw
", header=T)
data1intersourceHighgw <- data1[which(data1$intersource=="Highgw"),]
data1intersourceMidgw <- data1[which(data1$intersource=="Midgw"),]
data1intersourceLowgw <- data1[which(data1$intersource=="Lowgw"),]
data1intersourceHighrw <- data1[which(data1$intersource=="Highrw"),]
data1intersourceMidrw <- data1[which(data1$intersource=="Midrw"),]
data1intersourceLowrw <- data1[which(data1$intersource=="Lowrw"),]
data1intersourceHighsw <- data1[which(data1$intersource=="Highsw"),]
data1intersourceMidsw <- data1[which(data1$intersource=="Midsw"),]
data1intersourceLowsw <- data1[which(data1$intersource=="Lowsw"),]
data1_3 <- cbind(data1intersourceHighgw[,3], data1intersourceMidgw[,3], data1intersourceLowgw[,3],
data1intersourceHighrw[,3], data1intersourceMidrw[,3], data1intersourceLowrw[,3],
data1intersourceHighsw[,3], data1intersourceMidsw[,3], data1intersourceLowsw[,3])
colnames(data1_3) <- c("Highgw", "Midgw","Lowgw","Highrw","Midrw","Lowrw","Highsw","Midsw","Lowsw")
rownames(data1_3) <- data1intersourceMidgw$season
lower<-data1$mean-data1$se
upper<-data1$mean+data1$se
my.plot<-barplot(t(data1_3), beside=T, ylab="",
cex.names=0.8, cex.lab=1.3, cex.axis=1.3, ylim=c(0,120), col = gray.colors(9),las=1)
box(bty="l")
legend("topleft", c("Highgw", "Midgw","Lowgw","Highrw","Midrw","Lowrw","Highsw","Midsw","Lowsw"),
cex=1.0, pch=c(15), col = gray.colors(9))
arrows(my.plot, t(data1_3), my.plot, lower, angle=90,length=.1)
arrows(my.plot, t(data1_3), my.plot, upper, angle=90, length=.1)