capturePlot function

Capture a plot as a saved file