added code for plot2