R script for plot2.