the final R-codes for the plots