Code for plot2