%% Main Plot with Adjacent Smaller Plots
% A tiled chart layout consists of a grid of tiles surrounded by four outer tiles. You can place legends, colorbars, additional axes, or even a nested layout into any of these tiles. In this case, create a main plot in the center, and use one of the outer tiles to display a set of supplemental plots.
% First, create a matrix of sine waves and plot them together in a 1-by-1 tiled chart layout.

x = (0:0.1:10)';
y = sin([x x+1 x+2 x+3 x+4 x+5]);
figure
t = tiledlayout(1,1);
nexttile
plot(x,y)

%
% Plot the individual sine waves below the main plot. To do this, create a new layout called ts in the south tile of layout t. When you create ts, specify the 'flow' tile arrangement so that the plots fill the entire south tile at each iteration of the for loop.

ts = tiledlayout(t,'flow');
ts.Layout.Tile = 'south';
for i=1:5
    nexttile(ts);
    plot(x,y(:,i))
end

% Copyright 2020 The MathWorks, Inc.