%% Use Specific Subplot to Determine Limits for All Subplots
% Load the |count.dat| data set which returns a three-column array named
% |count|. Create a new figure with three subplots and return the axes handles.
% In each subplot, create a bar graph.

% Copyright 2015 The MathWorks, Inc.


load count.dat  

figure
ax1 = subplot(3,1,1);
bar(count(:,1),'g');

ax2 = subplot(3,1,2);
bar(count(:,2),'b');

ax3 = subplot(3,1,3);
bar(count(:,3),'m');

%%
% Link the _x_-axes and _y_-axes limits using |linkaxes| with the argument
% |'xy'|. Base the limits on the third subplot by passing its axes handle,
% |ax3|, as the first input to |linkaxes|.

linkaxes([ax3,ax2,ax1],'xy');

%%
% If you zoom in on one subplot, then the other two subplots behave
% in the same manner. To enable interactive zooming, use |zoom on|. To
% disable zooming, use |zoom off|. 

