%% Link x-Axes And Change Axis Limits
% Load the |count.dat| data set which returns a three-column array named
% |count|. Create a new figure with two subplots and return the axes
% handles. In each subplot, create a bar graph.

% Copyright 2015 The MathWorks, Inc.


load count.dat
figure
ax1 = subplot(2,1,1);
bar(count(:,1),'g');     

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

%%
% Link the _x_-axes for the two subplots. 
linkaxes([ax1,ax2],'x');

%%
% Set the _x_-axis limits for the second subplot. Setting the limits
% overrides the limits initially set by |linkaxes|. Changing the _x_-axis
% limits effects both subplots.
ax2.XLim = [4.5,9.5];

%%
% If you pan either
% subplot, then both subplots pan uniformly in the _x_-direction, but only one
% subplot moves in the _y_-direction. To enable
% interactive panning, use |pan on|. To disable panning, use |pan off|. 