%% Add Line Plot to Existing Axes
% Create a line plot. Use hold on to add a second line plot without deleting the existing line plot. The new plot uses the next color and line style based on the ColorOrder and LineStyleOrder properties of the axes. Then reset the hold state to off.

x = linspace(-pi,pi);
y1 = sin(x);
plot(x,y1)

hold on
y2 = cos(x);
plot(x,y2)
hold off

%
% When the hold state is off, new plots delete existing plots. New plots start from the beginning of the color order and line style order.

y3 = sin(2*x);
plot(x,y3)

% Copyright 2012 The MathWorks, Inc.