Creating merged data frame for plot 4