MATLAB: How to show legend as subfigure

figureslegendsubplot

Dear All,
Let say I have subplots of 4 figures. First three figures have some curve plots. I want to show last figure (the forthone) as legend of figure three.
subplot(1,4,1), plot([1:100],'DisplayName','Fig 1');
subplot(1,4,2), plot([1:100],'DisplayName','Fig 2');
subplot(1,4,3), plot([1:100],'DisplayName','Fig 3');
now at figure 4 I want to show legend of figure 3. Is it possible ?

Best Answer

With some manipulation of the legend position handle you can:
EDIT: to update the text in legend
subplot(1,4,1), plot([1:100],'DisplayName','Fig 1');
subplot(1,4,2), plot([1:100],'DisplayName','Fig 2');
subplot(1,4,3), fig3handle = plot([1:100],'DisplayName','Fig 3');
a3pos = get ( gca, 'position' )
a = legend ( fig3handle )
get ( a, 'position' )
set ( a, 'position', [(a3pos(1)+a3pos(3)+(1-(a3pos(1)+a3pos(3)))/2)-a3pos(3)/2 a3pos(2) a3pos(3) a3pos(4)] )