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

    %% Return Subplot Axes Handle  
% Create a figure with two subplots. Plot the first 20 rows of the |peaks|
% function in the upper subplot. Plot the entire data set in the lower
% subplot.

% Copyright 2015 The MathWorks, Inc.


%%  
ax1 = subplot(2,1,1);
Z = peaks;
plot(ax1,Z(1:20,:))

ax2 = subplot(2,1,2);  
plot(ax2,Z)  

%% 
% Change the tick marks for the lower subplot. Starting in R2014b, you can
% use dot notation to set properties. If you are using an earlier release,
% use the <docid:matlab_ref.f67-432995> function instead.
ax2.XTick = [0,10,25,40,50];  

%%
% Some plotting functions set axes properties. Execute plotting functions
% before specifying axes properties to avoid overriding existing axes
% property settings.