plotData fucntion