Fixes to plotting routine and add figure plot script