R code for plot2