Wrote the plotting function for 2b.