R coding file for plot 1