refactored plot code
completed plot 4