Wrote plotting code