adding a plot function