Split out the R code so that each plot has its separate file