fig=bargraph.CI(x.factor=trt,response=mean,data=data[1:3,],ylim=c(0,1.5),cex.lab=0.9, cex.axis=1.0,
names.arg=c("","",""),ylab=expression("Species Persistence ( ", phi, " )")),
col=c("gray30","gray","white")
segments(fig$xvals,data$mean[1:3]+data$se[1:3],fig$xvals,data$mean[1:3]-data$se[1:3])
segments(fig$xvals-.05,data$mean[1:3]+data$se[1:3],fig$xvals+.05,data$mean[1:3]+data$se[1:3]) #Add the top cap
segments(fig$xvals-.05,data$mean[1:3]-data$se[1:3],fig$xvals+.05,data$mean[1:3]-data$se[1:3]) #Add the bottom cap
box(bty="l")
legend("topright",legend="A",bty="n",inset=c(-.02,-.05))
我在名称行后面收到此消息:
Error: unexpected ',' in:
"fig=bargraph.CI(x.factor=trt,response=mean,data=data[1:3,],ylim=c(0,1.5),cex.lab=0.9, cex.axis=1.0,
names.arg=c("","",""),ylab=expression("Species Persistence ( ", phi, " )")),"
> col=c("gray30","gray","white")
> fig=bargraph.CI(x.factor=trt,response=mean,data=data[1:3,],ylim=c(0,1.5),cex.lab=0.9, cex.axis=1.0,
+ names.arg=c("","",""),ylab=expression("Species Persistence ( ", phi " )")),
Error: unexpected string constant in:
"fig=bargraph.CI(x.factor=trt,response=mean,data=data[1:3,],ylim=c(0,1.5),cex.lab=0.9, cex.axis=1.0,
names.arg=c("","",""),ylab=expression("Species Persistence ( ", phi " )""
> col=c("gray30","gray","white")
> segments(fig$xvals,data$mean[1:3]+data$se[1:3],fig$xvals,data$mean[1:3]-data$se[1:3])
答案 0 :(得分:1)
使用:
ylab=expression(paste("Species Persistence ( ", phi, " )"))
而不是:
ylab=expression("Species Persistence ( ", phi, " )")
答案 1 :(得分:1)
我建议尽可能避免在情节中使用paste
。 IMO的使用抑制了useRs理解表达式的正确构造:
library(sciplot)
fig=bargraph.CI(x.factor=trt,response=mean,data=data[1:3,],
ylim=c(0,1.5),cex.lab=0.9, cex.axis=1.0,
names.arg=c("","",""),
ylab=expression("Species Persistence ( "* phi* " )" ) ,
col=c("gray30","gray","white")
)
(我认为你在expression
的行中有一个额外的“)”然后无法关闭它。)
答案 2 :(得分:0)
这是最好的:
#Local Species Persistence
fig=bargraph.CI(x.factor=trt,response=mean,data=data[1:3,],ylim=c(0,1.0),cex.lab=1, cex.axis=1.0, cex.names=1.0,
names.arg=c("","",""),ylab=expression("Species Persistence ("* italic(phi)* ")" ) ,
col=c("gray30","gray","white")
)