code to read data for plot scripts. completed plot1 script