all four plots and corresponding R code