code for plot3