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

    %% Subplots at Specified Positions  
% Create a figure with two subplots that are not aligned.   

% Copyright 2015 The MathWorks, Inc.


%% 
% Define |y| as data from the |magic| function. 
y = magic(4);  

%% 
% Plot |y| in one subplot. Create a bar graph of |y| in a second subplot.
% Specify a custom position for each subplot.

figure
positionVector1 = [0.1, 0.2, 0.3, 0.3];
subplot('Position',positionVector1)
plot(y)

positionVector2 = [0.5, 0.1, 0.4, 0.7];
subplot('Position',positionVector2)
bar(y)