Implementation of plot and export functionality