added .tex writeup and plotting function