completed plot3.R