script and plot for 3rd figure