Add function to plot data