Code for figure Course Project 1