Code for Plot 2