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

    %% Specify Subplot for Bar Graph
% Create a figure with two subplots. In the upper subplot, plot a bar graph. 
% In the lower subplot, plot a stacked bar graph of the same data.

% Copyright 2015 The MathWorks, Inc.


y = [1 2 3; 4 5 6];
ax1 = subplot(2,1,1);
bar(ax1,y)

ax2 = subplot(2,1,2); 
bar(ax2,y,'stacked')