add plot function.