Very clunky R Code for plots 1 and 2.