script and plot for 4th figure