R code for all 4 plot