www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/MaintainCurrentzAxisLimitsExample.m

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

% Copyright 2015 The MathWorks, Inc.


%%
% First, create a 3-D scatter plot.
theta = linspace(0,2*pi);
X = cos(theta);
Y = sin(theta);
Z = theta;
scatter3(X,Y,Z)

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

zlim manual
hold on 
Znew = 5*theta;
scatter3(X,Y,Znew)
hold off


%% 
% The _z_-axis limits do not update to incorporate the new plot. 
%
% Switch back to automatically updated limits by setting the mode to
% automatic.
zlim auto