Code for plot3