completed code to make plots