www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/RetainCurrentAxisLimitsWhenAddingNewPlotsExample.m
%% Retain Current Axis Limits When Adding New Plots % Plot a sine wave. % Copyright 2015 The MathWorks, Inc. x = linspace(0,10); y = sin(x); plot(x,y) %% % Add another sine wave to the axes using |hold on|. Keep the current axis % limits by setting the limits mode to manual. y2 = 2*sin(x); hold on axis manual plot(x,y2) hold off %% % If you want the axes to choose the appropriate limits, set the limits % mode back to automatic. axis auto