%% Maintain Current x-Axis Limits
% Use manual mode to maintain the current x-axis limits when you add more plots to the axes.
% First, plot a line.

x = linspace(0,10);
y = sin(x);
plot(x,y);

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

xlim manual
hold on
plot(2*x,2*y)
hold off

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

xlim auto

% Copyright 2015 The MathWorks, Inc.