Added option for the graph to plot  a function