You have no hold on in what you show. When hold is not on (or equivalent internal settings) then each plot() call effectively calls cla() before doing the plotting, which would have the effect of deleting the existing line.
Try
if ishandle(p2); delete(p2); end