Align the Legend Title to the Legend body
36 views (last 30 days)
Show older comments
Sim on 14 Sep 2020
Commented: Sim on 23 Sep 2020
Hi, How can I align the Legend Title to the Legend body (variables, etc..)? Maybe left-aligned ?
Ayush Gupta on 18 Sep 2020
The legend title is by-default left aligned to legend body. Refer to the code below which generates the following picture and read the documentation on how to add legend title, here.
x = linspace(0,pi);
y1 = cos(x);
y2 = cos(2*x);
lgd = legend('cos(x)','cos(2x)');
title(lgd,'My Legend Title')
Find more on Legend in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!