![](/matlabcentral/answers/uploaded_files/114094/33.jpg)
How to increase the length of the legend line?
조회 수: 130 (최근 30일)
이전 댓글 표시
Hello, I would like to increase the length (not linewidth) of the line inside the legend. Does anyone has an idea? Thanks you.
t = [0:0.1:2*pi]
a = sin(t);
b = cos(t);
plot(t,a,t,b,'linewidth',3)
l = legend({'Sinus','Cosinus'},...
'location','southwest','FontName','TimesNewRoman','FontSize',20);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/187949/image.png)
답변 (3개)
KALYAN ACHARJYA
2018년 4월 21일
편집: Walter Roberson
2020년 9월 8일
I don't think it is customizable directly, go to the following links to user-defined function-
댓글 수: 4
Luca Menegozzo
2020년 11월 28일
편집: Luca Menegozzo
2020년 11월 28일
The best solution to the problem without extra functions. Thank you!
Afiq Azaibi
2024년 10월 9일
Starting in R2024b, you can leverage the IconColumnWidth property on legend to increase the length of the line:
t = [0:0.1:2*pi]
a = sin(t);
b = cos(t);
plot(t,a,t,b,'linewidth',3)
l = legend({'Sinus','Cosinus'},...
'location','southwest','FontName','TimesNewRoman','FontSize',20);
l.IconColumnWidth = 60;
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Legend에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!