Code to generate plot2