Initial import of output plotting code, provided by Tade