Code for Plot2