update to plotting function