first step plot code