checking in plot code for reuse