%% Set Axis Limits for Multiple Axes
% Starting in R2019b, you can display a tiling of plots using the tiledlayout and nexttile functions. Call the tiledlayout function to create a 2-by-1 tiled chart layout. Call the nexttile function to create the axes objects ax1 and ax2. Plot data in each axes. Then set the axis limits for both axes to the same values.

tiledlayout(2,1)
x1 = linspace(0,10,100);
y1 = sin(x1);
ax1 = nexttile;
plot(ax1,x1,y1)

x2 = linspace(0,5,100);
y2 = sin(x2);
ax2 = nexttile;
plot(ax2,x2,y2)

axis([ax1 ax2],[0 10 -1 1])

% Copyright 2019 The MathWorks, Inc.