Added save option to plotting function