###########################################################Figure 4 df<- read.csv("2_field.csv") data<-df%>% filter(year== "2020") #2020 stem-to-leaf ratio Figure 4A p1 <- ggplot(data=data, aes(x=factor(Date, level=c('2020/8/6', '2020/8/27', '2020/10/3')),y=stem_ratio, fill=factor(treatment,level=c('N0', 'N20', 'N60', 'N120', 'N180')))) + geom_bar(position = "dodge", stat="identity",colour = "black",size=0.3)+ geom_errorbar(aes(x = Date, y = stem_ratio, ymin = stem_ratio - stem_error, ymax = stem_ratio + stem_error), width = 0.3,size=0.3,position=position_dodge(.9)) + xlab(expression(paste(Date)))+ labs(y=expression(Stem~to~leaf~(g/g~DM)))+ mytheme2+ theme(legend.position = c(0.15,0.80), legend.text = element_text(size = 8, family = "serif"), legend.title = element_text( size = 9), legend.key.size = unit(0.3, 'cm'))+ scale_y_continuous(expand = c(0,0),limits = c(0,2)) + geom_text(label = c("a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "ab", "b", "b", "ab", "a"), family="serif", aes(y = stem_ratio + stem_error, x = Date), hjust = 0.45,vjust= -0.4, size = 3, position = position_dodge(width = 0.9), stat="identity")+ scale_fill_manual( values = c("#00AFBB", "#E7B800", "#FC4E07","cornflowerblue","violet"),name = NULL)+ theme( axis.title.y = element_text(vjust = 3,margin = margin(t =0, r = 0, b = 0, l = 0)), axis.title.x = element_text(vjust = -1,margin = margin(t =0, r = 0, b = 0, l = 0)))+ theme(plot.margin = unit(c(1,1,0.5,1), "cm")) # ("left", "top", "bottom", "right") p1 #2021 stem-to-leaf ratio Figure 4B data<-df%>% filter(year== "2021") data$cut1 = factor(data$cut, levels=c('First regrowth','Second regrowth','Third regrowth')) p2 <- ggplot(data=data, aes(x=factor(Date, level=c('2021/5/26', '2021/6/3', '2021/6/15', '2021/7/16','2021/7/30','2021/8/7','2021/9/24')), y=stem_ratio, fill=factor(treatment,level=c('N0', 'N20', 'N60', 'N120', 'N180')))) + facet_grid(. ~cut1, scales="free_x", space = "free") + geom_bar(position = "dodge", stat="identity",colour = "black",size=0.3)+ geom_errorbar(aes(x = Date, y = stem_ratio, ymin = stem_ratio - stem_error, ymax = stem_ratio + stem_error), width = 0.3,size=0.3,position=position_dodge(.9)) + xlab(expression(paste(Date)))+ labs(y=expression(Stem~to~leaf~(g/g~DM)))+ mytheme2+ theme(legend.position = c(0.08,0.85), legend.text = element_text(size = 8, family = "serif"), legend.title = element_text( size = 7), legend.key.size = unit(0.3, 'cm'))+ scale_y_continuous(expand = c(0,0),limits = c(0,2.5)) + scale_fill_manual( values = c("#00AFBB", "#E7B800", "#FC4E07","cornflowerblue","violet"),name = NULL)+ geom_text(label = c("a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "ab", "b", "b", "ab", "a", "ab", "ab", "b", "b", "a", "a", "a", "a", "a", "a"), family="serif", aes(y = stem_ratio + stem_error, x = Date), hjust = 0.45,vjust= -0.4, size = 3, position = position_dodge(width = 0.9), stat="identity")+ theme( axis.title.y = element_text(vjust = 3,margin = margin(t =0, r = 0, b = 0, l = 0)), axis.title.x = element_text(vjust = -1,margin = margin(t =0, r = 0, b = 0, l = 0)))+ theme(plot.margin = unit(c(1,1,0.5,1), "cm")) # ("left", "top", "bottom", "right") p2 ###############Figure 4 alfalfa setm:leaf plot_all <- cowplot::plot_grid(p1, p2, labels = "AUTO",label_fontfamily="serif",nrow = 1,rel_widths = c (1,2)) ggsave("paper_field_ratio_c.png", plot=plot_all, height=12, width=25, units="cm", dpi=600)