Code creating figure 4 in the writeup