How to change the length of the lines inside the legend?
11 次查看(过去 30 天)
显示 更早的评论
The green one is a solid line and the blue one is a dashed line. Clearly this is not indicative from the legend. How can this issue be circumvented as I couldn't find any options that could modify this from property editor ? I use the property editor to modify plots. Please give a solution that does not use additional lines of code.
0 个评论
回答(2 个)
Ankit
2019-9-27
编辑:Ankit
2019-9-27
Hello Sandeep,
check this interesting file in FEX: https://de.mathworks.com/matlabcentral/fileexchange/58914-resizelegend-varargin
please have a look here how you can modify the length of lines in a legend:
However, it is always good to check in FEX or google it before asking :)
Regards
Ankit
1 个评论
Christina Lebonville
2024-4-16
Sandeep's question is not answered by any of those links as they need to edit the lines from the property editor. I am in the same boat and want to edit it from the property editor as I'm using an already saved figure. So far googling has found no solutions that do not involve either a whole function or additional code.
Afiq Azaibi
2024-10-9
Starting in R2024b, you can leverage the IconColumnWidth property on legend to increase the length of the icons:
plot(1:10,'linewidth',3);
hold on
plot(2:11, 'linewidth', 3, 'linestyle', '--');
l = legend({'plot1','plot2'},'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!