code for plot 4 done