library("ggpubr", lib.loc="~/R/win-library/3.6")
library("dplyr", lib.loc="~/R/win-library/3.6")
library("ggplot2", lib.loc="~/R/win-library/3.6")
library("wesanderson", lib.loc="~/R/win-library/3.6")

Data is named OMRrain, and is setup as follows:

OMR <- read.csv("OMRrain.csv", header=TRUE)
head(OMR)

And this is the code used to create the figure relating OMR to MAR at each collection point:

OMR1<-OMR %>% filter(collection=="One")
OMR2<-OMR %>% filter(collection=="Two")
OMR3<-OMR %>% filter(collection=="Three")
OMR4<-OMR %>% filter(collection=="Four")
OMR5<-OMR %>% filter(collection=="Five")
T1<-ggscatter(OMR1,x="rain",y="OMR", color="species",
              add = "reg.line",
              palette = "d3",
              legend.title="Species")+
  stat_cor(aes(color = species,label = paste(..rr.label.., ..p.label.., sep = "~`,`~")),
           label.y.npc="bottom",
           label.x.npc="left")+
  ylim(60,100)+
  xlab("Rainfall (mm)")+
  ylab("Organic matter remaining (%)")+
  theme(legend.position = c(0.8, 0.2))+
  ggtitle("(a) At 5 weeks")

T2<-ggscatter(OMR2,x="rain",y="OMR", color="species",
              add = "reg.line",
              palette = "d3",
              legend.title="Species")+
  stat_cor(aes(color = species,label = paste(..rr.label.., ..p.label.., sep = "~`,`~")),
           label.y.npc="bottom",
           label.x.npc="left")+
  ylim(60,100)+
  xlab("Rainfall (mm)")+
  ylab("Organic matter remaining (%)")+
  theme(legend.position = c(0.8, 0.2))+
  ggtitle("(b) At 11 weeks")

T3<-ggscatter(OMR3,x="rain",y="OMR", color="species",
              add = "reg.line",
              palette = "d3",
              legend.title="Species")+
  stat_cor(aes(color = species,label = paste(..rr.label.., ..p.label.., sep = "~`,`~")),
           label.y.npc="bottom",
           label.x.npc="left")+
  ylim(60,100)+
  xlab("Rainfall (mm)")+
  ylab("Organic matter remaining (%)")+
  theme(legend.position = c(0.8, 0.2))+
  ggtitle("(c) At 18 weeks")

T4<-ggscatter(OMR4,x="rain",y="OMR", color="species",
              add = "reg.line",
              palette = "d3",
              legend.title="Species")+
  stat_cor(aes(color = species,label = paste(..rr.label.., ..p.label.., sep = "~`,`~")),
           label.y.npc="bottom",
           label.x.npc="left")+
  ylim(60,100)+
  xlab("Rainfall (mm)")+
  ylab("Organic matter remaining (%)")+
  theme(legend.position = c(0.8, 0.2))+
  ggtitle("(d) At 24 weeks")

T5<-ggscatter(OMR5,x="rain",y="OMR", color="species",
              add = "reg.line",
              palette = "d3",
              legend.title="Species")+
  stat_cor(aes(color = species,label = paste(..rr.label.., ..p.label.., sep = "~`,`~")),
           label.y.npc="top",
           label.x.npc="left")+
  ylim(60,100)+
  xlab("Rainfall (mm)")+
  ylab("Organic matter remaining (%)")+
  theme(legend.position = c(0.8, 0.8))+
  ggtitle("(e) At 39 weeks")

OMRMARplot2<-ggarrange(T1,T2,T3,T4,T5, common.legend=TRUE, legend="right", ncol = 5, nrow = 1)
OMRMARplot2

ggsave("OMR rain 300 fixed.jpg",width=18,height=4.5,dpi=300)
ggsave("OMR rain 300 fixed.tiff",width=18,height=4.5,dpi=300)
Final plot as a JPG

Final plot as a JPG

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.