adding second function for plotting data