Finished code to create plots