R script for plot3.