%% Maintain Current _y_-Axis Limits
% Use manual mode to maintain the current _y_-axis limits when you add more
% plots to the axes.

% Copyright 2015 The MathWorks, Inc.


%% 
% First, plot a line.
x = linspace(0,10);
y = sin(x);
plot(x,y)

%%
% Set the _y_-axis limits mode to manual so that the limits to not change.
% Use |hold on| to add a second plot to the axes. 

ylim manual
hold on
y2 = 2*sin(x);
plot(x,y2)
hold off

%% 
% The _y_-axis limits do not update to incorporate the new plot. 
%
% Switch back to automatically updated limits by resetting the mode
% to automatic. 

ylim auto
