reads data file and plots graph correctly