Updated trace plotting function.