implemented code and generated output for plot1