R script for plots