MATLAB: How and where to place the legend box in a “tiledlayout”

tiledlayout

Dear community,
I have to plot four plots usinusing tiledlayout. The legend is the same for all four plots. Logically, I woudl like find the way somehow omit the legend dublicatiion in each plot. Placing the legend in one, singe figure (Image below) is also not a solution.
Is there any idea how to please the legend, for example, below the main title "Comparison of 2D histograms".
If any other idea will appeare, please share them,

Best Answer

Starting in 2020b, Legend and Colorbar have a Layout property that gives you more control of positioning them in a TiledChartLayout. Here's an example of placing a legend in the north tile, under the title.
tl = tiledlayout('flow');
nexttile
plot(rand(1,10));
hold on
plot(rand(1,10));
nexttile
plot(rand(1,10));
hold on
plot(rand(1,10));
leg = legend('Orientation', 'Horizontal');
leg.Layout.Tile = 'north';
title(tl, 'Legend in the north tile');