plot3 implementation