script for merging data to create plot