updated 'formatforplot.R' utility function