绘制不同CO2,物种和天数之间的气孔导度。
p<-ggplot(data=gssummary,aes(x=factor(day),y=Cond,fill=factor(co2)))+geom_bar(stat = "identity",position = "dodge",width=0.4,colour="black")+geom_errorbar(aes(ymin=Cond-ci,ymax=Cond+ci), width=.1,position = position_dodge(0.4))+theme_bw()+theme(panel.grid=element_blank())+labs(x="Day",y=expression(plain("g"["s"])))+facet_grid(~species)+theme(axis.ticks=element_line(size=rel(0.1)))+theme(axis.text=element_text(size = rel(0.5),family = "Times"))+theme(axis.title=element_text(size = 7,family = "Times"))+theme(plot.margin=unit(c(0,3,0,0),"cm"))+theme(strip.text=element_text(size=rel(0.6),family = "Times"),strip.background=element_rect(colour = "white",fill = "white"))+theme(panel.border=element_rect(colour = "black",size = 1))+guides(fill=guide_legend(title=NULL))+scale_fill_grey(start = 1,end = 0.75,labels=c(expression(plain("aCO"["2"])),expression(plain("eCO"["2"]))))
将有意义的信息添加到图中(2016年9月2日在物种0中,aco2和eco2之间的差异仅显着)
siglabel<-data.frame(species=c("0","1"),label=c("*"," "))
p+geom_text(x=1,y=0.6,aes(label=label),data = siglabel)
错误:美学必须是长度为1或与dataProblems相同的长度:标签
我试过但仍然无法解决这个问题。请告诉我如何解决它。非常感谢!
答案 0 :(得分:0)
实际上,问题是标签的长度与gssummary的长度不同。我更改了代码如下。
siglabel&LT; -data.frame(物种= C( “0”, “0”, “1”, “1”),CO 2 = C( “0”, “1”, “0”, “1” ),label = c(“*”,“”,“”,“”))
p + geom_text(x = 1,y = 0.6,aes(label = label),data = siglabel)