adding plotting function