R code for creating plot1