implemented CSV saving of plots