Final R code to generate PNG plots