Code and plot for plot1.