create helper function for plotting data