R code for new plots