MATLAB Answers

Align the Legend Title to the Legend body

44 ビュー (過去 30 日間)
Sim 2020 年 9 月 14 日
コメント済み: Sim 2020 年 9 月 23 日
Hi, How can I align the Legend Title to the Legend body (variables, etc..)? Maybe left-aligned ?
  5 件のコメント
Adam Danz
Adam Danz 2020 年 9 月 14 日
I'd be interesting in whatever you find.


回答 (1 件)

Ayush Gupta
Ayush Gupta 2020 年 9 月 18 日
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);
hold on
y2 = cos(2*x);
hold off
lgd = legend('cos(x)','cos(2x)');
title(lgd,'My Legend Title')
  6 件のコメント
Sim 2020 年 9 月 23 日
Oh cool, thanks a lot for highlighting that feature... So, if not working for the Legends, my MATLAB ticket opening was worth it :)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by