code for plot 6