###################################################################figure 7 ###############################alfalfa cp #2020 CP figure 7A data<-df%>% filter(year== "2020") p1 <- ggplot(data=data, aes(x=factor(Date, level=c('2020/8/6', '2020/8/27', '2020/10/3')),y=CP, 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 = CP, ymin = CP - CP_error, ymax = CP + CP_error), width = 0.3,size=0.3,position=position_dodge(.9)) + xlab(expression(paste(Date)))+ labs(y=expression(Alfalfa~Crude~Protein~("%")))+ mytheme2+ theme(legend.position = c(0.85, 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,40)) + geom_text(label = c("Ab", "Aab", "Aab","Aa", "Aa", "Ac", "Aab", "Aa", "ABbc", "ABabc", "Ab", "Aa", "Aab", "Bab", "Bab"), family="serif", aes(y = CP + CP_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 CP figure 7B 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=CP, 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 = CP, ymin = CP - CP_error, ymax = CP + CP_error), width = 0.3,size=0.3,position=position_dodge(.9)) + xlab(expression(paste(Date)))+ labs(y=expression(Alfalfa~Crude~Protein~("%")))+ mytheme2+ theme(legend.position =c(0.08, 0.86), 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,40)) + geom_text(label = c("ABb", "Ab", "ABab","ABa", "ABab", "Cab", "Ba", "Cab", "Cab", "Cb", "Da", "Ca", "Da", "Da", "Da", "Ab", "Aab", "Aa","Aa", "Aab", "ABb","Aab","ABa","ABa","Aa", "BCa", "Ba", "BCa", "Ca", "BCa", "Aa", "Aa", "Ba", "ABa", "Aa"), family="serif", aes(y = CP + CP_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") p2 ########## cp <- cowplot::plot_grid(p1, p2, labels = "AUTO",label_fontfamily="serif",nrow = 1,rel_widths = c (1,2)) ##############################################alfalfa ADF #2020ADF figure 7C data<-df%>% filter(year== "2020") p1 <- ggplot(data=data, aes(x=factor(Date, level=c('2020/8/6', '2020/8/27', '2020/10/3')),y=ADF, 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 = ADF, ymin = ADF - ADF_error, ymax = ADF + ADF_error), width = 0.3,size=0.3,position=position_dodge(.9)) + xlab(expression(paste(Date)))+ labs(y=expression(Alfalfa~Acid~Detergent~Fiber~("%")))+ mytheme2+ theme(legend.position = c(0.15,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,60)) + geom_text(label = c("ab", "ab", "ab","b", "a", "a", "a", "a", "a", "a", "a", "bc", "ab", "c", "a", "ab"), family="serif", aes(y = ADF + ADF_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 #2021ADF figure 7D 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=ADF, 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 = ADF, ymin = ADF - ADF_error, ymax = ADF + ADF_error), width = 0.3,size=0.3,position=position_dodge(.9)) + xlab(expression(paste(Date)))+ labs(y=expression(Alfalfa~Acid~Detergent~Fiber~("%")))+ mytheme2+ theme(legend.position = c(0.08,0.86), 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,60)) + labs(fill=' ')+ geom_text(label = c("a", "ab", "ab","b", "ab", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "ab", "b","ab", "ab", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a"), family="serif", aes(y = ADF + ADF_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") p2 ########## ADF<- cowplot::plot_grid(p1, p2, labels = c("C","D"),label_fontfamily="serif",nrow = 1,rel_widths = c (1, 2)) #########################################alfalfa NDF #2020NDF figure 7E data<-df%>% filter(year== "2020") p1 <- ggplot(data=data, aes(x=factor(Date, level=c('2020/8/6', '2020/8/27', '2020/10/3')),y=NDF, 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 = NDF, ymin = NDF - NDF_error, ymax = NDF + NDF_error), width = 0.3,size=0.3,position=position_dodge(.9)) + xlab(expression(paste(Date)))+ labs(y=expression(Alfalfa~Neutral~Detergent~Fiber~("%")))+ mytheme2+ theme(legend.position = c(0.15,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,80),breaks = seq(0,80,20)) + geom_text(label = c("a", "a", "a","a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a"), family="serif", aes(y = NDF + NDF_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 ######2021NDF figure 7F #NDF 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=NDF, 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 = NDF, ymin = NDF - NDF_error, ymax = NDF + NDF_error), width = 0.3,size=0.3,position=position_dodge(.9)) + xlab(expression(paste(Date)))+ labs(y=expression(Alfalfa~Neutral~Detergent~Fiber~("%")))+ mytheme2+ theme(legend.position =c(0.08,0.86), 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,80)) + labs(fill=' ')+ geom_text(label = c("a", "ab", "ab","b", "ab", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "ab", "b","ab", "ab", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a"), family="serif", aes(y = NDF + NDF_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") p2 NDF <- cowplot::plot_grid(p1, p2, labels = c("E","F"),label_fontfamily="serif",nrow = 1,rel_widths = c (1, 2)) NDF plot_all <- cowplot::plot_grid(cp, ADF,NDF, labels = NULL,label_fontfamily="serif",nrow = 3) plot_all ggsave("paper_field_quality_c.png", plot=plot_all, height=30, width=25, units="cm", dpi=600)