%% Display Shared Colorbar in Tiled Chart Layout
% When you want to share a colorbar between two or more plots, you can display the colorbar in a separate tile of the layout.
% Create filled contour plots of the peaks and membrane data sets in a tiled chart layout.

Z1 = peaks;
Z2 = membrane;
tiledlayout(2,1);
nexttile
contourf(Z1)
nexttile
contourf(Z2)

%
% Add a colorbar, and move it to the east tile.

cb = colorbar;
cb.Layout.Tile = 'east';

% Copyright 2020 The MathWorks, Inc.