Updating the script for R plots.