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

    %% Add Colorbars to Subplots
% Create a figure with two subplots. Add colorbars to
% both subplots.

% Copyright 2015 The MathWorks, Inc.


figure
subplot(2,1,1) % upper subplot 
surf(peaks)
colorbar

subplot(2,1,2) % lower subplot
contourf(peaks)
colorbar