! , 2016a 2017a .
, Matlab.
. - . Position, NodeChildren, .
, . , :
[hleg,att] = legend('show');
title(hleg,'my title')
hleg.Title.NodeChildren.Position
ans =
0 0 0
. :
hleg.Title.NodeChildren.Position = [0.5 1.5 0];
(x = 0,5) (y = 1,5), , (z = 0):

, , (, ), . , ...
:
hleg.Title.NodeChildren.BackgroundColor = 'w';
, . , , . ( ), :
x = 1:0.1:10;
plot(x,sin(x),x,cos(x))
[hleg,icons,plots] = legend('show');
title(hleg,'my title')
hleg.Title.Visible = 'on';
% the addition in height needed for the title:
title_hight = hleg.Position(4)/numel(plots);
hleg.Position([2 4]) = [hleg.Position(2)-title_hight hleg.Position(4)+title_hight];
% calculate new position for the elements in the legeng:
new_pos = fliplr(0.5/(numel(plots)+1):1/(numel(plots)+1):1);
hleg.Title.NodeChildren.Position = [0.5 new_pos(1) 0];
% set the text to the right position:
leg_txt = findobj(icons,'Type','Text');
txt_pos = cell2mat({leg_txt.Position}.');
txt_pos(:,2) = new_pos(2:end);
set(leg_txt,{'Position'},mat2cell(txt_pos,[1 1],3));
% set the icons to the right position:
leg_att = findobj(icons,'Type','Line');
set(leg_att,{'YData'},mat2cell(repmat(repelem(new_pos(2:end).',...
numel(plots)),1,2),ones(numel(plots)*2,1),2))
, , , .
